TestOverridenPrivateMethods.java revision 181:47a62d8d98b4
190075Sobrien/* 290075Sobrien * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. 390075Sobrien * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 490075Sobrien * 590075Sobrien * This code is free software; you can redistribute it and/or modify it 690075Sobrien * under the terms of the GNU General Public License version 2 only, as 790075Sobrien * published by the Free Software Foundation. 8110611Skan * 990075Sobrien * This code is distributed in the hope that it will be useful, but WITHOUT 1090075Sobrien * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1190075Sobrien * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1290075Sobrien * version 2 for more details (a copy is included in the LICENSE file that 1390075Sobrien * accompanied this code). 1490075Sobrien * 1590075Sobrien * You should have received a copy of the GNU General Public License version 1690075Sobrien * 2 along with this work; if not, write to the Free Software Foundation, 1790075Sobrien * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1890075Sobrien * 1990075Sobrien * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2090075Sobrien * CA 95054 USA or visit www.sun.com if you need additional information or 2190075Sobrien * have any questions. 2290075Sobrien */ 2390075Sobrien 2490075Sobrien/* 2590075Sobrien * @test 2690075Sobrien * @bug 4634891 2790075Sobrien * @summary Determine if overriden methods are properly documented when 2890075Sobrien * -protected (default) visibility flag is used. 2990075Sobrien * @author jamieh 3090075Sobrien * @library ../lib/ 3190075Sobrien * @build JavadocTester 3290075Sobrien * @build TestOverridenPrivateMethods 3390075Sobrien * @run main TestOverridenPrivateMethods 3490075Sobrien */ 3590075Sobrien 3690075Sobrienpublic class TestOverridenPrivateMethods extends JavadocTester { 3790075Sobrien 3890075Sobrien private static final String BUG_ID = "4634891"; 3990075Sobrien 4090075Sobrien private static final String[][] TEST = { 4190075Sobrien //The public method should be overriden 4290075Sobrien {BUG_ID + FS + "pkg1" + FS + "SubClass.html", 43110611Skan "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, 4490075Sobrien 4590075Sobrien //The public method in different package should be overriden 4690075Sobrien {BUG_ID + FS + "pkg2" + FS + "SubClass.html", 4790075Sobrien "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"} 4890075Sobrien }; 4990075Sobrien 5090075Sobrien private static final String[][] NEGATED_TEST = { 5190075Sobrien 5290075Sobrien //The package private method should be overriden since the base and sub class are in the same 5390075Sobrien //package. However, the link should not show up because the package private methods are not documented. 5490075Sobrien {BUG_ID + FS + "pkg1" + FS + "SubClass.html", 5590075Sobrien "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}, 5690075Sobrien 5790075Sobrien //The private method in should not be overriden 5890075Sobrien {BUG_ID + FS + "pkg1" + FS + "SubClass.html", 5990075Sobrien "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, 6090075Sobrien 6190075Sobrien //The private method in different package should not be overriden 6290075Sobrien {BUG_ID + FS + "pkg2" + FS + "SubClass.html", 6390075Sobrien "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, 6490075Sobrien 6590075Sobrien //The package private method should not be overriden since the base and sub class are in 6690075Sobrien //different packages. 6790075Sobrien {BUG_ID + FS + "pkg2" + FS + "SubClass.html", 6890075Sobrien "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"} 6990075Sobrien }; 7090075Sobrien 7190075Sobrien private static final String[] ARGS = 7290075Sobrien new String[] { 7390075Sobrien "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2"}; 7490075Sobrien 7590075Sobrien /** 7690075Sobrien * The entry point of the test. 7790075Sobrien * @param args the array of command line arguments. 7890075Sobrien */ 7990075Sobrien public static void main(String[] args) { 8090075Sobrien TestOverridenPrivateMethods tester = new TestOverridenPrivateMethods(); 8190075Sobrien run(tester, ARGS, TEST, NEGATED_TEST); 8290075Sobrien tester.printSummary(); 8390075Sobrien } 8490075Sobrien 8590075Sobrien /** 8690075Sobrien * {@inheritDoc} 8790075Sobrien */ 8890075Sobrien public String getBugId() { 8990075Sobrien return BUG_ID; 9090075Sobrien } 9190075Sobrien 9290075Sobrien /** 9390075Sobrien * {@inheritDoc} 9490075Sobrien */ 9590075Sobrien public String getBugName() { 9690075Sobrien return getClass().getName(); 9790075Sobrien } 9890075Sobrien} 9990075Sobrien