01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.debug.jdi.tests;
11:
12: import com.sun.jdi.event.ThreadStartEvent;
13:
14: /**
15: * Tests for JDI com.sun.jdi.event.ThreadStartEvent.
16: */
17: public class ThreadStartEventTest extends AbstractJDITest {
18:
19: private ThreadStartEvent fEvent;
20:
21: /**
22: * Creates a new test.
23: */
24: public ThreadStartEventTest() {
25: super ();
26: }
27:
28: /**
29: * Init the fields that are used by this test only.
30: */
31: public void localSetUp() {
32: // Make sure the entire VM is not suspended before we start a new thread
33: // (otherwise this new thread will start suspended and we will never get the
34: // ThreadStart event)
35: fVM.resume();
36:
37: // Trigger a thread start event
38: fEvent = (ThreadStartEvent) triggerAndWait(fVM
39: .eventRequestManager().createThreadStartRequest(),
40: "ThreadStartEvent", true);
41: }
42:
43: /**
44: * Make sure the test leaves the VM in the same state it found it.
45: */
46: public void localTearDown() {
47: // The test has resumed the test thread, so suspend it
48: waitUntilReady();
49: }
50:
51: /**
52: * Run all tests and output to standard output.
53: * @param args
54: */
55: public static void main(java.lang.String[] args) {
56: new ThreadStartEventTest().runSuite(args);
57: }
58:
59: /**
60: * Gets the name of the test case.
61: * @see junit.framework.TestCase#getName()
62: */
63: public String getName() {
64: return "com.sun.jdi.event.ThreadStartEvent";
65: }
66:
67: /**
68: * Test JDI thread().
69: */
70: public void testJDIThread() {
71: assertEquals("1", "Test Thread Start Event", fEvent.thread()
72: .name());
73: }
74: }
|