/* * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 8263468 8269401 8268422 8287524 * @summary New page for "recent" new API * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool * @build javadoc.tester.* * @run main TestNewApiList */ import javadoc.tester.JavadocTester; /** * Test --since option and "New API" list. */ public class TestNewApiList extends JavadocTester { public static void main(String... args) throws Exception { TestNewApiList test = new TestNewApiList(); test.runTests(); } @Test public void testMultiRelease() throws Exception { javadoc("-d", "out-multi", "--no-platform-links", "--module-source-path", testSrc, "--since", "0.9,v1.0,1.2,2.0b,3.2,5", "--since-label", "New API in recent releases", "--module", "mdl", "pkg"); checkExit(Exit.OK); checkMultiReleaseContents(); checkMultiReleaseNewElements(); checkMultiReleaseDeprecatedElements(); } @Test public void testSingleRelease() throws Exception { javadoc("-d", "out-single", "--no-platform-links", "--module-source-path", testSrc, "--since", "5", "--module", "mdl", "pkg"); checkExit(Exit.OK); checkSingleReleaseContents(); checkSingleReleaseNewElements(); checkSingleReleaseDeprecatedElements(); } @Test public void testPackage() throws Exception { javadoc("-d", "out-package", "--no-platform-links", "-sourcepath", testSrc, "--since", "1.2,2.0b,3.2,5,6", "pkg"); checkExit(Exit.OK); checkPackageContents(); checkPackageNewElements(); checkPackageDeprecatedElements(); } @Test public void testNoList() throws Exception { javadoc("-d", "out-none", "--no-platform-links", "--module-source-path", testSrc, "--since", "foo,bar", "--since-label", "New API in foo and bar", "--module", "mdl", "pkg"); checkExit(Exit.OK); checkFiles(false, "new-list.html"); } private void checkMultiReleaseContents() { checkOutput("new-list.html", true, """

New API in recent releases

Contents

Show API added in:
"""); } private void checkMultiReleaseNewElements() { checkOutput("new-list.html", true, """
New Modules
Module
Added in
Description
3.2
Module mdl.
""", """
New Packages
Package
Added in
Description
v1.0
Package pkg.
""", """
New Interfaces
Interface
Added in
Description
0.9
Test interface.
""", """
New Classes
Class
Added in
Description
1.2
TestClass declaration.
""", """
New Enum Classes
Enum Class
Added in
Description
0.9
Test enum class.
""", """
New Exception Classes
Exception Class
Added in
Description
2.0b
Test error class.
0.9
Test exception class.
""", """
New Record Classes
Record Class
Added in
Description
pkg.TestRecord
3.2
Test record.
""", """
New Annotation Interfaces
Annotation Interface
Added in
Description
2.0b
An annotation interface.
""", """
New Fields
Field
Added in
Description
1.2
TestClass field.
v1.0
Test error field.
3.2
Exception field.
2.0b
Test interface field.
""", """
New Methods
Method
Added in
Description
3.2
Optional annotation interface element.
2.0b
Required annotation interface element.
2.0b
TestClass method.
5
TestClass overloaded method.
3.2
Test error method.
1.2
Exception method.
v1.0
Interface method.
3.2
Interface method.
5
Test record getter.
""", """
New Constructors
Constructor
Added in
Description
2.0b
TestClass constructor.
3.2
TestClass constructor.
5
Test error constructor.
5
Exception constructor.
""", """
New Enum Constants
Enum Constant
Added in
Description
<\ a href="mdl/pkg/TestEnum.html#DEPRECATED">pkg.TestEnum.DEPRECATED
3.2
Deprecated.
pkg.TestEnum.ONE
0.9
One.
<\ a href="mdl/pkg/TestEnum.html#THREE">pkg.TestEnum.THREE
1.2
Three.
pkg.TestEnum.TWO
v1.0
Two.
""", """
New Annotation Interface Elements
Annotation Interface Element
Added in
Description
3.2
Optional annotation interface element.
2.0b
Required annotation interface element.
"""); } private void checkMultiReleaseDeprecatedElements() { checkOutput("deprecated-list.html", true, """
Terminally Deprecated Elements
Element
Deprecated in
Description
3.2
""", """
Deprecated Methods
Method
Deprecated in
Description
3.2
""", """
Deprecated Constructors
Constructor
Deprecated in
Description
6
""", """
Deprecated Enum Constants
Enum Constant
Deprecated in
Description
<\ a href="mdl/pkg/TestEnum.html#DEPRECATED">pkg.TestEnum.DEPRECATED
5
""", """
Deprecated Annotation Interface Elements
Annotation Interface Element
Deprecated in
Description
3.2
"""); } private void checkSingleReleaseContents() { checkOutput("new-list.html", true, """

New API

Contents