EnumTest.java revision 1485
/*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* @test
* @bug 4728816
* @summary JPDA: Add support for enums
*
* @author jjh
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g EnumTest.java
* @run main EnumTest
*/
/********** target program **********/
enum Coin {
private final int value;
}
class EnumTarg {
}
}
/********** test program **********/
public class EnumTest extends TestScaffold {
super(args);
}
}
}
/********** test core **********/
/*
* Get to the top of main()
* to determine targetClass
*/
}
fail("failure: isEnum() is false but should be true");
}
fail("failure: isEnum() is true for EnumTarg but should be false");
}
if (!enumConstant.isEnumConstant()) {
fail("failure: The 'penny' field is not marked " +
"as an enum constant.");
}
/*
* This isn't really part of the test, it just
* shows how to look at all the enum constants,
* but not necessarily in the correct order
*/
char delim = ' ';
if (aField.isEnumConstant()) {
delim = ',';
}
}
/*
* deal with results of test
* if anything has called failure("foo") testFailed will be true
*/
if (!testFailed) {
println("EnumTest: passed");
} else {
throw new Exception("EnumTest: failed");
}
}
}