diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-14 00:09:02 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-14 00:11:47 +0700 |
commit | 2fd6804db8aebfe6634e4df7d5e5c71fe856d4f6 (patch) | |
tree | 542e1f1feb804342b7a17ec7851dfec2f5575790 /ajdoc | |
parent | cd83adc724c3779cc688405cc475ca5bd1e13bfe (diff) | |
download | aspectj-2fd6804db8aebfe6634e4df7d5e5c71fe856d4f6.tar.gz aspectj-2fd6804db8aebfe6634e4df7d5e5c71fe856d4f6.zip |
Fix 'ajdoc' tests for Java 15 build
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'ajdoc')
5 files changed, 156 insertions, 108 deletions
diff --git a/ajdoc/pom.xml b/ajdoc/pom.xml index fa24692c9..e92109017 100644 --- a/ajdoc/pom.xml +++ b/ajdoc/pom.xml @@ -35,13 +35,11 @@ <version>${project.version}</version> </dependency> <dependency> - - <!-- enables easy dependency on tools.jar --> - <groupId>com.github.olivergondza</groupId> - <artifactId>maven-jdk-tools-wrapper</artifactId> - <version>0.1</version> -</dependency> - + <!-- enables easy dependency on tools.jar --> + <groupId>com.github.olivergondza</groupId> + <artifactId>maven-jdk-tools-wrapper</artifactId> + <version>0.1</version> + </dependency> <dependency> <groupId>asm</groupId> <artifactId>asm</artifactId> @@ -49,5 +47,45 @@ <scope>system</scope> <systemPath>${project.basedir}/../lib/asm/asm-8.0.1.renamed.jar</systemPath> </dependency> + + <!-- Dependencies needed for running tests in this module independently of complete reactor build --> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.eclipse.jdt.core</artifactId> + <version>1.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/../org.eclipse.jdt.core/jdtcore-for-aspectj.jar</systemPath> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>org.aspectj.matcher</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>weaver</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>bcel-builder</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>runtime</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.aspectj</groupId> + <artifactId>testing-util</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + </dependencies> </project> diff --git a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java index 42d029e06..3e3a05c07 100644 --- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java +++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java @@ -31,6 +31,7 @@ import org.aspectj.asm.AsmManager; import org.aspectj.asm.HierarchyWalker; import org.aspectj.asm.IProgramElement; import org.aspectj.asm.IRelationship; +import org.aspectj.util.LangUtil; import org.aspectj.util.TypeSafeEnum; /** @@ -38,6 +39,10 @@ import org.aspectj.util.TypeSafeEnum; */ class HtmlDecorator { + public static final String TYPE_NAME_LABEL = LangUtil.is15VMOrGreater() + ? "type-name-label" + : (LangUtil.is1dot8VMOrGreater() ? "typeNameLabel" : "strong"); + private static final String POINTCUT_DETAIL = "Pointcut Detail"; private static final String ADVICE_DETAIL = "Advice Detail"; private static final String DECLARE_DETAIL = "Declare Detail"; @@ -267,19 +272,14 @@ class HtmlDecorator { } } else { - // Java8: - // <pre>static class <span class="typeNameLabel">ClassA.InnerAspect</span> - classStartIndex = fileContents.toString().indexOf("class <span class=\"typeNameLabel\">"); - if (classStartIndex == -1) { - // Java7: 464604 - // <pre>public class <span class="strong">Azpect</span> - classStartIndex = fileContents.toString().indexOf("class <span class=\"strong\">"); - } + // Java15: <pre>static class <span class="type-name-label">ClassA.InnerAspect</span> + // Java8: <pre>static class <span class="typeNameLabel">ClassA.InnerAspect</span> + // Java7 (464604): <pre>public class <span class="strong">Azpect</span> + classStartIndex = fileContents.toString().indexOf("class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">"); int classEndIndex = fileContents.toString().indexOf("</span>", classStartIndex); if (classEndIndex != -1) { - // Convert it to "aspect <span class="typeNameLabel">ClassA.InnerAspect</span>" - String classLine = fileContents.toString().substring(classStartIndex, classEndIndex); - String aspectLine = "aspect"+fileContents.substring(classStartIndex+5,classEndIndex); + // Convert it to "aspect <span class="TYPE_NAME_LABEL">ClassA.InnerAspect</span>" + String aspectLine = "aspect" + fileContents.substring(classStartIndex + 5, classEndIndex); fileContents.delete(classStartIndex, classEndIndex); fileContents.insert(classStartIndex, aspectLine); } diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java index 431018401..3e69f4887 100644 --- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java +++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocOutputChecker.java @@ -1,11 +1,11 @@ /******************************************************************** - * Copyright (c) 2005 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation + * Copyright (c) 2005 Contributors. All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation * Helen Hawkins - iniital version *******************************************************************/ package org.aspectj.tools.ajdoc; @@ -25,8 +25,8 @@ import org.aspectj.util.LangUtil; public class AjdocOutputChecker { /** - * Checks whether the given html file contains the required String. - * + * Checks whether the given html file contains the required String. + * * @param htmlFile * @param requiredString * @return true if the file contains the given string or @@ -53,12 +53,12 @@ public class AjdocOutputChecker { /** * Returns those strings from the given array which aren't in the html file. - * + * * @param htmlFile * @param an array of requiredStrings * @return a List of those strings not found * @throws Exception - */ + */ public static List<String> getMissingStringsInFile(File htmlFile, String[] requiredStrings) throws Exception { List<String> missingStrings = new ArrayList<>(); for (String string : requiredStrings) { @@ -68,16 +68,16 @@ public class AjdocOutputChecker { } return missingStrings; } - + /** * Checks whether the section of the html file contains the * required String - * + * * @param htmlFile * @param requiredString * @param sectionHeader - * @return true if the file contains the given string within the - * required section or false otherwise (or if the file is null or + * @return true if the file contains the given string within the + * required section or false otherwise (or if the file is null or * not an html file) * @throws Exception */ @@ -91,7 +91,7 @@ public class AjdocOutputChecker { while (line != null) { if (line.contains(sectionHeader)) { String nextLine = reader.readLine(); - while (nextLine != null && + while (nextLine != null && (!nextLine.contains("========"))) { if (nextLine.contains(requiredString)) { reader.close(); @@ -107,11 +107,11 @@ public class AjdocOutputChecker { reader.close(); return false; } - + /** * Returns those strings from the given array which aren't in the - * ajdoc html file - * + * ajdoc html file + * * @param htmlFile * @param an array of requiredStrings * @param sectionHeader @@ -130,10 +130,10 @@ public class AjdocOutputChecker { } /** - * Returns whether the class data section has the expected - * relationship and target i.e. have the relationships been + * Returns whether the class data section has the expected + * relationship and target i.e. have the relationships been * applied to the type. - * + * * @param the ajdoc html file * @param the detail sectionHeader, for example "DECLARE DETAIL SUMMARY" * @param the source of the relationship, for example "Point()" @@ -143,7 +143,7 @@ public class AjdocOutputChecker { * false otherwise */ public static boolean classDataSectionContainsRel(File htmlFile, - HtmlDecorator.HtmlRelationshipKind relationship, + HtmlDecorator.HtmlRelationshipKind relationship, String target) throws Exception { if (((htmlFile == null) || !htmlFile.getAbsolutePath().endsWith("html"))) { return false; @@ -154,7 +154,7 @@ public class AjdocOutputChecker { if (line.contains("START OF CLASS DATA")) { // found the required class data section String subLine = reader.readLine(); - while(subLine != null + while(subLine != null && (!subLine.contains("========"))){ int relIndex = subLine.indexOf(relationship.toString()); int targetIndex = subLine.indexOf(target); @@ -175,11 +175,11 @@ public class AjdocOutputChecker { reader.close(); return false; } - + /** - * Returns whether the supplied source has the expected + * Returns whether the supplied source has the expected * relationship and target within the given detail section - * + * * @param the ajdoc html file * @param the detail sectionHeader, for example "DECLARE DETAIL SUMMARY" * @param the source of the relationship, for example "Point()" @@ -188,9 +188,9 @@ public class AjdocOutputChecker { * @return true if the section contains the expected source/relationship/target, * false otherwise */ - public static boolean detailSectionContainsRel(File htmlFile, - String sectionHeader, String source, - HtmlDecorator.HtmlRelationshipKind relationship, + public static boolean detailSectionContainsRel(File htmlFile, + String sectionHeader, String source, + HtmlDecorator.HtmlRelationshipKind relationship, String target) throws Exception { if (((htmlFile == null) || !htmlFile.getAbsolutePath().endsWith("html"))) { return false; @@ -210,9 +210,9 @@ public class AjdocOutputChecker { nextLine.contains("NAME=\"" + source + "\"") || nextLine.contains("name=\"" + source + "\"")) { // found the required subsection String subLine = reader.readLine(); - while(subLine != null + while(subLine != null && (!subLine.contains("========")) - && (!subLine.contains("NAME") && !subLine.contains("name"))) { + && (!subLine.contains("NAME=") && !subLine.contains("name="))) { int relIndex = subLine.indexOf(relationship.toString()); int targetIndex = subLine.indexOf(target); if ((relIndex != -1) && (targetIndex != -1)) { @@ -239,9 +239,9 @@ public class AjdocOutputChecker { } /** - * Returns whether the supplied source has the expected + * Returns whether the supplied source has the expected * relationship and target within the given summary section - * + * * @param the ajdoc html file * @param the detail sectionHeader, for example "DECLARE SUMMARY" * @param the source of the relationship, for example "Point()" @@ -251,10 +251,10 @@ public class AjdocOutputChecker { * false otherwise */ public static boolean summarySectionContainsRel( - File htmlFile, - String sectionHeader, - String source, - HtmlDecorator.HtmlRelationshipKind relationship, + File htmlFile, + String sectionHeader, + String source, + HtmlDecorator.HtmlRelationshipKind relationship, String target) throws Exception { if (((htmlFile == null) || !htmlFile.getAbsolutePath().endsWith("html"))) { return false; @@ -272,7 +272,7 @@ public class AjdocOutputChecker { if (nextLine.contains(source)) { // found the required subsection String subLine = nextLine; - while(subLine != null + while(subLine != null && (!subLine.contains("========")) && (!subLine.contains("<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">"))) { int relIndex = subLine.indexOf(relationship.toString()); @@ -299,5 +299,5 @@ public class AjdocOutputChecker { reader.close(); return false; } - + } diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java index acfb5eda4..0baeb7dcd 100644 --- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java +++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/AjdocTestCase.java @@ -1,11 +1,11 @@ /******************************************************************** - * Copyright (c) 2005 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution and is available at - * http://eclipse.org/legal/epl-v10.html - * - * Contributors: IBM Corporation - initial API and implementation + * Copyright (c) 2005 Contributors. All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution and is available at + * http://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation * Helen Hawkins - iniital version *******************************************************************/ package org.aspectj.tools.ajdoc; @@ -160,12 +160,12 @@ public abstract class AjdocTestCase extends TestCase { if (inputFiles.length == 0) { fail("need to pass some files into ajdoc"); } - if (!sourceLevel.equals("1.3") && - !sourceLevel.equals("1.4") && - !sourceLevel.equals("1.5") && - !sourceLevel.equals("1.6") && - !sourceLevel.equals("1.7") && - !sourceLevel.equals("1.8") && + if (!sourceLevel.equals("1.3") && + !sourceLevel.equals("1.4") && + !sourceLevel.equals("1.5") && + !sourceLevel.equals("1.6") && + !sourceLevel.equals("1.7") && + !sourceLevel.equals("1.8") && !sourceLevel.equals("1.9") && !sourceLevel.equals("10")) { fail("need to pass ajdoc '1.3' > '1.9' as the source level"); @@ -191,12 +191,12 @@ public abstract class AjdocTestCase extends TestCase { if (!visibility.equals("public") && !visibility.equals("protected") && !visibility.equals("private")) { fail("need to pass 'public','protected' or 'private' visibility to ajdoc"); } - if (!sourceLevel.equals("1.3") && - !sourceLevel.equals("1.4") && - !sourceLevel.equals("1.5") && - !sourceLevel.equals("1.6") && - !sourceLevel.equals("1.7") && - !sourceLevel.equals("1.8") && + if (!sourceLevel.equals("1.3") && + !sourceLevel.equals("1.4") && + !sourceLevel.equals("1.5") && + !sourceLevel.equals("1.6") && + !sourceLevel.equals("1.7") && + !sourceLevel.equals("1.8") && !sourceLevel.equals("1.9") && !sourceLevel.startsWith("9") && !sourceLevel.startsWith("10")) { @@ -217,7 +217,7 @@ public abstract class AjdocTestCase extends TestCase { args[2] = sourceLevel; args[3] = "-classpath"; StringBuilder classpath = new StringBuilder(); - if (LangUtil.is19VMOrGreater()) { + if (LangUtil.is9VMOrGreater()) { classpath.append(LangUtil.getJrtFsFilePath()).append(File.pathSeparator); } classpath.append(AjdocTests.ASPECTJRT_PATH.getPath()); diff --git a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java index ea8568cd8..3be100998 100644 --- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java +++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java @@ -131,9 +131,9 @@ public class CoverageTestCase extends AjdocTestCase { String[] strings = null; strings = new String[] { "Aspect ClassA.InnerAspect", - "<pre>static aspect <span class=\"typeNameLabel\">ClassA.InnerAspect</span>", + "<pre>static aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA.InnerAspect</span>", "Class ClassA.InnerAspect", - "<pre>static class <span class=\"typeNameLabel\">ClassA.InnerAspect</span>"}; + "<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA.InnerAspect</span>"}; List<String> missingStrings = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings); StringBuilder buf = new StringBuilder(); for (String str:missingStrings) { @@ -144,7 +144,7 @@ public class CoverageTestCase extends AjdocTestCase { assertTrue(htmlFile.getName() + " should not have Class as it's title", missingStrings.contains("Class ClassA.InnerAspect")); assertTrue(htmlFile.getName() + " should not have class in its subtitle", - missingStrings.contains("<pre>static class <span class=\"typeNameLabel\">ClassA.InnerAspect</span>")); + missingStrings.contains("<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA.InnerAspect</span>")); // get the html file for the enclosing class File htmlFileClass = new File(getAbsolutePathOutdir() + "/foo/ClassA.html"); @@ -160,21 +160,21 @@ public class CoverageTestCase extends AjdocTestCase { if (LangUtil.is13VMOrGreater()) { classStrings = new String[] { "Class ClassA</h1>", - "public abstract class <span class=\"typeNameLabel\">ClassA</span>", + "public abstract class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>", "Aspect ClassA</H2>", - "public abstract aspect <span class=\"typeNameLabel\">ClassA</span>"}; + "public abstract aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>"}; } else { classStrings = new String[] { "Class ClassA</h2>", - "public abstract class <span class=\"typeNameLabel\">ClassA</span>", + "public abstract class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>", "Aspect ClassA</H2>", - "public abstract aspect <span class=\"typeNameLabel\">ClassA</span>"}; + "public abstract aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>"}; } List<String> classMissing = AjdocOutputChecker.getMissingStringsInFile(htmlFileClass,classStrings); assertEquals("There should be 2 missing strings:\n"+classMissing,2,classMissing.size()); assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title",classMissing.contains("Aspect ClassA</H2>")); assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle", - classMissing.contains("public abstract aspect <span class=\"typeNameLabel\">ClassA</span>")); + classMissing.contains("public abstract aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>")); } /** @@ -657,14 +657,19 @@ public class CoverageTestCase extends AjdocTestCase { String[] strings = null; strings = new String[] { "Aspect PkgVisibleClass.NestedAspect", - "<pre>static aspect <span class=\"typeNameLabel\">PkgVisibleClass.NestedAspect</span>", + "<pre>static aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass.NestedAspect</span>", "Class PkgVisibleClass.NestedAspect", - "<pre>static class <span class=\"typeNameLabel\">PkgVisibleClass.NestedAspect</span>"}; - List<String> missing = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings); - assertEquals("There should be 2 missing strings",2,missing.size()); - assertTrue(htmlFile.getName() + " should not have Class as it's title",missing.contains("Class PkgVisibleClass.NestedAspect")); + "<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass.NestedAspect</span>"}; + List<String> missingStrings = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings); + StringBuilder buf = new StringBuilder(); + for (String str:missingStrings) { + buf.append(str).append("\n"); + } + buf.append("HTMLFILE=\n").append(htmlFile).append("\n"); + assertEquals("There should be 2 missing strings",2,missingStrings.size()); + assertTrue(htmlFile.getName() + " should not have Class as it's title",missingStrings.contains("Class PkgVisibleClass.NestedAspect")); assertTrue(htmlFile.getName() + " should not have class in its subtitle", - missing.contains("<pre>static class <span class=\"typeNameLabel\">PkgVisibleClass.NestedAspect</span>")); + missingStrings.contains("<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass.NestedAspect</span>")); // get the html file for the enclosing class File htmlFileClass = new File(getAbsolutePathOutdir() + "/PkgVisibleClass.html"); if (!htmlFileClass.exists()) { @@ -678,22 +683,22 @@ public class CoverageTestCase extends AjdocTestCase { if (LangUtil.is13VMOrGreater()) { classStrings = new String[] { "Class PkgVisibleClass</h1>", - "<pre>class <span class=\"typeNameLabel\">PkgVisibleClass</span>", + "<pre>class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>", "Aspect PkgVisibleClass</h2>", - "<pre>aspect <span class=\"typeNameLabel\">PkgVisibleClass</span>"}; + "<pre>aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>"}; } else { classStrings = new String[] { "Class PkgVisibleClass</h2>", - "<pre>class <span class=\"typeNameLabel\">PkgVisibleClass</span>", + "<pre>class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>", "Aspect PkgVisibleClass</h2>", - "<pre>aspect <span class=\"typeNameLabel\">PkgVisibleClass</span>"}; + "<pre>aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>"}; } List<String> classMissing = AjdocOutputChecker.getMissingStringsInFile(htmlFileClass,classStrings); assertEquals("There should be 2 missing strings",2,classMissing.size()); assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title", classMissing.contains("Aspect PkgVisibleClass</h2>")); assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle", - classMissing.contains("<pre>aspect <span class=\"typeNameLabel\">PkgVisibleClass</span>")); + classMissing.contains("<pre>aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>")); } /** @@ -716,14 +721,19 @@ public class CoverageTestCase extends AjdocTestCase { String[] strings = null; strings = new String [] { "Aspect ClassWithNestedAspect.NestedAspect", - "<pre>static aspect <span class=\"typeNameLabel\">ClassWithNestedAspect.NestedAspect</span>", + "<pre>static aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect.NestedAspect</span>", "Class ClassWithNestedAspect.NestedAspect", - "<pre>static class <span class=\"typeNameLabel\">ClassWithNestedAspect.NestedAspect</span>"}; - List<String> missing = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings); - assertEquals("There should be 2 missing strings",2,missing.size()); - assertTrue(htmlFile.getName() + " should not have Class as it's title",missing.contains("Class ClassWithNestedAspect.NestedAspect")); + "<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect.NestedAspect</span>"}; + List<String> missingStrings = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings); + StringBuilder buf = new StringBuilder(); + for (String str:missingStrings) { + buf.append(str).append("\n"); + } + buf.append("HTMLFILE=\n").append(htmlFile).append("\n"); + assertEquals("There should be 2 missing strings",2,missingStrings.size()); + assertTrue(htmlFile.getName() + " should not have Class as it's title",missingStrings.contains("Class ClassWithNestedAspect.NestedAspect")); assertTrue(htmlFile.getName() + " should not have class in its subtitle", - missing.contains("<pre>static class <span class=\"typeNameLabel\">ClassWithNestedAspect.NestedAspect</span>")); + missingStrings.contains("<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect.NestedAspect</span>")); // get the html file for the enclosing class File htmlFileClass = new File(getAbsolutePathOutdir() + "/pkg/ClassWithNestedAspect.html"); @@ -738,22 +748,22 @@ public class CoverageTestCase extends AjdocTestCase { if (LangUtil.is13VMOrGreater()) { classStrings = new String[] { "Class ClassWithNestedAspect</h1>", - "public class <span class=\"typeNameLabel\">ClassWithNestedAspect</span>", + "public class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>", "Aspect ClassWithNestedAspect</h2>", - "public aspect <span class=\"typeNameLabel\">ClassWithNestedAspect</span>"}; + "public aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>"}; } else { classStrings = new String[] { "Class ClassWithNestedAspect</h2>", - "public class <span class=\"typeNameLabel\">ClassWithNestedAspect</span>", + "public class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>", "Aspect ClassWithNestedAspect</h2>", - "public aspect <span class=\"typeNameLabel\">ClassWithNestedAspect</span>"}; + "public aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>"}; } List<String> classMissing = AjdocOutputChecker.getMissingStringsInFile(htmlFileClass,classStrings); assertEquals("There should be 2 missing strings",2,classMissing.size()); assertTrue(htmlFileClass.getName() + " should not have Aspect as it's title", classMissing.contains("Aspect ClassWithNestedAspect</h2>")); assertTrue(htmlFileClass.getName() + " should not have aspect in its subtitle", - classMissing.contains("public aspect <span class=\"typeNameLabel\">ClassWithNestedAspect</span>")); + classMissing.contains("public aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>")); } /** |