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.ClassPrepareEvent;
13: import com.sun.jdi.request.ClassPrepareRequest;
14:
15: /**
16: * Tests for JDI com.sun.jdi.event.ClassPrepareEvent.
17: */
18: public class ClassPrepareEventTest extends AbstractJDITest {
19: private ClassPrepareRequest fRequest;
20: private ClassPrepareEvent fEvent;
21:
22: /**
23: * Creates a new test.
24: */
25: public ClassPrepareEventTest() {
26: super ();
27: }
28:
29: /**
30: * Init the fields that are used by this test only.
31: */
32: public void localSetUp() {
33: // Trigger a class prepare event
34: fRequest = fVM.eventRequestManager()
35: .createClassPrepareRequest();
36: fEvent = (ClassPrepareEvent) triggerAndWait(fRequest,
37: "ClassPrepareEvent", true);
38: }
39:
40: /**
41: * Make sure the test leaves the VM in the same state it found it.
42: */
43: public void localTearDown() {
44: // The test has resumed the test thread, so suspend it
45: waitUntilReady();
46:
47: // Delete the class prepare request
48: fVM.eventRequestManager().deleteEventRequest(fRequest);
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 ClassPrepareEventTest().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.ClassPrepareEvent";
65: }
66:
67: /**
68: * Test JDI referenceType().
69: */
70: public void testJDIReferenceType() {
71: assertEquals("1",
72: "org.eclipse.debug.jdi.tests.program.TestClass", fEvent
73: .referenceType().name());
74: }
75:
76: /**
77: * Test JDI thread().
78: */
79: public void testJDIThread() {
80: assertEquals("1", "Test Thread", fEvent.thread().name());
81: }
82: }
|