|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.test.refactoring.usages; import junit.textui.TestRunner; import org.netbeans.junit.NbTestSuite; /** * Find Usages simple tests * @author Emanuel Hucka */ public class SimpleTest extends WhereUsedTestCase { private static final String CLASS_NAME = "org.netbeans.tests.examples.packa.Bean"; private static final String CLASS_NAME_2 = "org.netbeans.tests.examples.packb.BeanA"; private static final String CLASS_NAME_3 = "org.netbeans.tests.examples.packb.BeanB"; private static final String CLASS_NAME_4 = "org.netbeans.tests.examples.packb.BeanD"; private static final String CLASS_NAME_5 = "org.netbeans.tests.examples.packb.BeansD.BeanDA"; private static final String IFACE_NAME_1 = "org.netbeans.tests.examples.packc.Makable"; private static final String IFACE_NAME_2 = "org.netbeans.tests.examples.packa.Testable"; /** Creates a new instance of Signature1Test */ public SimpleTest(String name) { super(name); } public static NbTestSuite suite() { NbTestSuite suite = new NbTestSuite(); suite.addTest(new SimpleTest("testClass")); suite.addTest(new SimpleTest("testClassAllSubTypes")); suite.addTest(new SimpleTest("testClassDirectSubTypes")); suite.addTest(new SimpleTest("testInterface")); suite.addTest(new SimpleTest("testInterfaceAllSubTypes")); suite.addTest(new SimpleTest("testInterfaceDirectSubTypes")); suite.addTest(new SimpleTest("testConstructor")); //suite.addTest(new SimpleTest("testMethod")); suite.addTest(new SimpleTest("testMethodUsagesOverriding")); suite.addTest(new SimpleTest("testMethodOverriding")); suite.addTest(new SimpleTest("testMethodOverridingBase")); suite.addTest(new SimpleTest("testMethodUsagesBase")); suite.addTest(new SimpleTest("testMethodUsagesBaseOverriding")); suite.addTest(new SimpleTest("testField")); return suite; } public void testClass() { findClass(CLASS_NAME); findClass(CLASS_NAME_2); findClass(CLASS_NAME_3); findClass(CLASS_NAME_4); findClass(CLASS_NAME_5); findClass("java.lang.String"); } public void testClassAllSubTypes() { findClassParams(CLASS_NAME, true, false); findClassParams(CLASS_NAME_2, true, false); findClassParams(CLASS_NAME_3, true, false); findClassParams(CLASS_NAME_4, true, false); findClassParams(CLASS_NAME_5, true, false); findClassParams("java.lang.String", true, false); } public void testClassDirectSubTypes() { findClassParams(CLASS_NAME, true, true); findClassParams(CLASS_NAME_2, true, true); findClassParams(CLASS_NAME_3, true, true); findClassParams(CLASS_NAME_4, true, true); findClassParams(CLASS_NAME_5, true, true); findClassParams("java.lang.String", true, true); } public void testInterface() { findClass(IFACE_NAME_1); findClass(IFACE_NAME_2); } public void testInterfaceAllSubTypes() { findClassParams(IFACE_NAME_1, true, false); findClassParams(IFACE_NAME_2, true, false); } public void testInterfaceDirectSubTypes() { findClassParams(IFACE_NAME_1, true, true); findClassParams(IFACE_NAME_2, true, true); } public void testField() { findField(CLASS_NAME, "refID"); findField(CLASS_NAME_2, "protectedProperty"); findField(IFACE_NAME_1, "CODE"); } public void testConstructor() { findConstructor(CLASS_NAME_3, new String[0]); findConstructor(CLASS_NAME_5, new String[] {"java.lang.String"}); } public void testMethod() { findMethod(IFACE_NAME_1, "make", new String[] {"int", "java.lang.String", "org.netbeans.tests.examples.packa.Bean"}); findMethod(IFACE_NAME_2, "test", null); findMethod(CLASS_NAME, "abc", null); findMethod(CLASS_NAME_2, "getProtectedProperty", null); findMethod("java.io.PrintStream", "println", new String[] {"java.lang.String"}); } public void testMethodUsagesOverriding() { findMethodParams(IFACE_NAME_1, "make", new String[] {"int", "java.lang.String", "org.netbeans.tests.examples.packa.Bean"}, false, true, true); findMethodParams(IFACE_NAME_2, "test", null, false, true, true); findMethodParams(CLASS_NAME, "abc", null, false, true, true); findMethodParams(CLASS_NAME_2, "getProtectedProperty", null, false, true, true); findMethodParams("java.io.PrintStream", "println", new String[] {"java.lang.String"}, false, true, true); } public void testMethodOverriding() { findMethodParams(IFACE_NAME_1, "make", new String[] {"int", "java.lang.String", "org.netbeans.tests.examples.packa.Bean"}, false, true, false); findMethodParams(IFACE_NAME_2, "test", null, false, true, false); findMethodParams(CLASS_NAME, "abc", null, false, true, false); findMethodParams(CLASS_NAME_2, "getProtectedProperty", null, false, true, false); findMethodParams("java.io.PrintStream", "println", new String[] {"java.lang.String"}, false, true, false); } public void testMethodOverridingBase() { findMethodParams(IFACE_NAME_1, "make", new String[] {"int", "java.lang.String", "org.netbeans.tests.examples.packa.Bean"}, true, true, false); findMethodParams(IFACE_NAME_2, "test", null, true, true, false); findMethodParams(CLASS_NAME, "abc", null, true, true, false); findMethodParams(CLASS_NAME_2, "getProtectedProperty", null, true, true, false); findMethodParams("java.io.PrintStream", "println", new String[] {"java.lang.String"}, true, true, false); } public void testMethodUsagesBase() { findMethodParams(IFACE_NAME_1, "make", new String[] {"int", "java.lang.String", "org.netbeans.tests.examples.packa.Bean"}, true, false, true); findMethodParams(IFACE_NAME_2, "test", null, true, false, true); findMethodParams(CLASS_NAME, "abc", null, true, false, true); findMethodParams(CLASS_NAME_2, "getProtectedProperty", null, true, false, true); findMethodParams("java.io.PrintStream", "println", new String[] {"java.lang.String"}, true, false, true); } public void testMethodUsagesBaseOverriding() { findMethodParams(IFACE_NAME_1, "make", new String[] {"int", "java.lang.String", "org.netbeans.tests.examples.packa.Bean"}, true, true, true); findMethodParams(IFACE_NAME_2, "test", null, true, true, true); findMethodParams(CLASS_NAME, "abc", null, true, true, true); findMethodParams(CLASS_NAME_2, "getProtectedProperty", null, true, true, true); findMethodParams("java.io.PrintStream", "println", new String[] {"java.lang.String"}, true, true, true); } /** * Used for running test from inside the IDE by internal execution. * * @param args the command line arguments */ public static void main(String[] args) { TestRunner.run(suite()); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.