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.BooleanValue;
13:
14: /**
15: * Tests for JDI com.sun.jdi.BooleanValue.
16: */
17: public class BooleanValueTest extends AbstractJDITest {
18:
19: private BooleanValue fValue;
20:
21: /**
22: * Creates a new test.
23: */
24: public BooleanValueTest() {
25: super ();
26: }
27:
28: /**
29: * Init the fields that are used by this test only.
30: */
31: public void localSetUp() {
32: // Get boolean value for "true"
33: fValue = fVM.mirrorOf(true);
34: }
35:
36: /**
37: * Run all tests and output to standard output.
38: * @param args
39: */
40: public static void main(java.lang.String[] args) {
41: new BooleanValueTest().runSuite(args);
42: }
43:
44: /**
45: * Gets the name of the test case.
46: * @see junit.framework.TestCase#getName()
47: */
48: public String getName() {
49: return "com.sun.jdi.BooleanValue";
50: }
51:
52: /**
53: * Test JDI equals() and hashCode().
54: */
55: public void testJDIEquality() {
56: assertTrue("1", fValue.equals(fVM.mirrorOf(true)));
57: assertTrue("2", !fValue.equals(fVM.mirrorOf(false)));
58: assertTrue("3", !fValue.equals(new Object()));
59: assertTrue("4", !fValue.equals(null));
60: assertEquals("5", fValue.hashCode(), fVM.mirrorOf(true)
61: .hashCode());
62: assertTrue("6", fValue.hashCode() != fVM.mirrorOf(false)
63: .hashCode());
64: }
65:
66: /**
67: * Test JDI value().
68: */
69: public void testJDIValue() {
70: assertTrue("1", true == fValue.value());
71: }
72: }
|