TestClass.java revision 827:50a9a4db3500
118099Spst/* 218099Spst * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. 318099Spst * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 418099Spst * 518099Spst * This code is free software; you can redistribute it and/or modify it 618099Spst * under the terms of the GNU General Public License version 2 only, as 718099Spst * published by the Free Software Foundation. 818099Spst * 918099Spst * This code is distributed in the hope that it will be useful, but WITHOUT 1018099Spst * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1118099Spst * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1218099Spst * version 2 for more details (a copy is included in the LICENSE file that 1318099Spst * accompanied this code). 1418099Spst * 1518099Spst * You should have received a copy of the GNU General Public License version 1618099Spst * 2 along with this work; if not, write to the Free Software Foundation, 1718099Spst * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1818099Spst * 1918099Spst * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2018099Spst * CA 95054 USA or visit www.sun.com if you need additional information or 2118099Spst * have any questions. 2218099Spst */ 2318099Spst 2418099Spst/* 2518099Spst * @test 2618099Spst * @summary Tests <class> element 2718099Spst * @author Sergey Malenkov 2818099Spst */ 2918099Spst 3018099Spstimport java.beans.XMLDecoder; 3118099Spst 3218099Spstpublic final class TestClass extends AbstractTest { 3318099Spst public static final String PREFIX = "javax.swing.colorchooser."; 3418099Spst public static final String INTERFACE = "ColorSelectionModel"; 3518099Spst public static final String PUBLIC_CLASS = "DefaultColorSelectionModel"; 3618099Spst public static final String PRIVATE_CLASS = "DiagramComponent"; 3718099Spst public static final String XML 3818099Spst = "<java>\n" 3918099Spst + " <class>" + PREFIX + INTERFACE + "</class>\n" 4018099Spst + " <class>" + PREFIX + PUBLIC_CLASS + "</class>\n" 4118099Spst + " <class>" + PREFIX + PRIVATE_CLASS + "</class>\n" 4218128Spst + "</java>"; 4318128Spst 4418099Spst public static void main(String[] args) { 4518099Spst new TestClass().test(true); 4618099Spst } 4718099Spst 4818099Spst @Override 4918099Spst protected void validate(XMLDecoder decoder) { 5018099Spst validate(PREFIX + INTERFACE, decoder.readObject()); 5118099Spst validate(PREFIX + PUBLIC_CLASS, decoder.readObject()); 5218099Spst validate(PREFIX + PRIVATE_CLASS, decoder.readObject()); 5318099Spst } 5418099Spst 5518099Spst private static void validate(String name, Object object) { 5618099Spst Class type = (Class) object; 5718099Spst if (!type.getName().equals(name)) { 5818099Spst throw new Error(name + " expected"); 5918099Spst } 6018099Spst } 6118099Spst} 6218099Spst