001: /*******************************************************************************
002: * Copyright (c) 2000, 2005 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.debug.jdi.tests;
011:
012: import java.util.List;
013:
014: import com.sun.jdi.Type;
015:
016: /**
017: * Tests for JDI com.sun.jdi.VirtualMachine.classesByName
018: */
019: public class ClassesByNameTest extends AbstractJDITest {
020:
021: /**
022: * Creates a new test.
023: */
024: public ClassesByNameTest() {
025: super ();
026: }
027:
028: /**
029: * Init the fields that are used by this test only.
030: */
031: public void localSetUp() {
032:
033: }
034:
035: /**
036: * Run all tests and output to standard output.
037: * @param args
038: */
039: public static void main(java.lang.String[] args) {
040: new ClassesByNameTest().runSuite(args);
041: }
042:
043: /**
044: * Gets the name of the test case.
045: * @see junit.framework.TestCase#getName()
046: */
047: public String getName() {
048: return "com.sun.jdi.VirtualMachine.classesByName";
049: }
050:
051: /**
052: * Test that there is a class object for 'int[]'
053: */
054: public void testJDIIntArray() {
055: List classes = fVM.classesByName("int[]");
056: assertTrue("Should be a class for int[]", classes.size() == 1
057: && ((Type) classes.get(0)).signature().equals("[I"));
058: }
059:
060: /**
061: * Test that there is a class object for 'int[][]'
062: */
063: public void testJDIIntDoubleArray() {
064: List classes = fVM.classesByName("int[][]");
065: assertTrue("Should be a class for int[][]", classes.size() == 1
066: && ((Type) classes.get(0)).signature().equals("[[I"));
067: }
068:
069: /**
070: * tests signature for an array of long values
071: */
072: public void testJDILongArray() {
073: List classes = fVM.classesByName("long[]");
074: assertTrue("Should be a class for long[]", classes.size() == 1
075: && ((Type) classes.get(0)).signature().equals("[J"));
076: }
077:
078: /**
079: * tests signature of a two dimensional array of long values
080: */
081: public void testJDILongDoubleArray() {
082: List classes = fVM.classesByName("long[][]");
083: assertTrue("Should be a class for long[][]",
084: classes.size() == 1
085: && ((Type) classes.get(0)).signature().equals(
086: "[[J"));
087: }
088:
089: /**
090: * Test that there is a class object for 'java.lang.String[]'
091: */
092: public void testJDIStringArray() {
093: List classes = fVM.classesByName("java.lang.String[]");
094: assertTrue("Should be a class for java.lang.String[]", classes
095: .size() == 1
096: && ((Type) classes.get(0)).signature().equals(
097: "[Ljava/lang/String;"));
098: }
099:
100: /**
101: * Test that there is a class object for 'java.lang.String'
102: */
103: public void testJDIString() {
104: List classes = fVM.classesByName("java.lang.String");
105: assertTrue("Should be a class for java.lang.String", classes
106: .size() == 1
107: && ((Type) classes.get(0)).signature().equals(
108: "Ljava/lang/String;"));
109: }
110: }
|