aboutsummaryrefslogtreecommitdiffstats
path: root/ajdoc/src
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-14 23:41:11 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2021-03-16 08:25:27 +0700
commit798ee65035142594c43c8c154baaafd557d5d11e (patch)
tree381bd54bc4bf7df690a74333144eb059d27e0ce7 /ajdoc/src
parentfff8eef683e8b7e426319101d3bb9dec56c7d7d6 (diff)
downloadaspectj-798ee65035142594c43c8c154baaafd557d5d11e.tar.gz
aspectj-798ee65035142594c43c8c154baaafd557d5d11e.zip
Use static import for HtmlDecorator.TYPE_NAME_LABEL
Mini refactoring, making the code a bit less verbose Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'ajdoc/src')
-rw-r--r--ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java2
-rw-r--r--ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java50
2 files changed, 27 insertions, 25 deletions
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 3e3a05c07..0c519f0eb 100644
--- a/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java
+++ b/ajdoc/src/main/java/org/aspectj/tools/ajdoc/HtmlDecorator.java
@@ -275,7 +275,7 @@ class HtmlDecorator {
// 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 + "\">");
+ classStartIndex = fileContents.toString().indexOf("class <span class=\"" + TYPE_NAME_LABEL + "\">");
int classEndIndex = fileContents.toString().indexOf("</span>", classStartIndex);
if (classEndIndex != -1) {
// Convert it to "aspect <span class="TYPE_NAME_LABEL">ClassA.InnerAspect</span>"
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 3be100998..17f0bc9c4 100644
--- a/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java
+++ b/ajdoc/src/test/java/org/aspectj/tools/ajdoc/CoverageTestCase.java
@@ -16,6 +16,8 @@ import java.util.List;
import org.aspectj.util.LangUtil;
+import static org.aspectj.tools.ajdoc.HtmlDecorator.TYPE_NAME_LABEL;
+
/**
* A long way to go until full coverage, but this is the place to add more.
*
@@ -131,9 +133,9 @@ public class CoverageTestCase extends AjdocTestCase {
String[] strings = null;
strings = new String[] {
"Aspect ClassA.InnerAspect",
- "<pre>static aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA.InnerAspect</span>",
+ "<pre>static aspect <span class=\"" + TYPE_NAME_LABEL + "\">ClassA.InnerAspect</span>",
"Class ClassA.InnerAspect",
- "<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA.InnerAspect</span>"};
+ "<pre>static class <span class=\"" + TYPE_NAME_LABEL + "\">ClassA.InnerAspect</span>"};
List<String> missingStrings = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings);
StringBuilder buf = new StringBuilder();
for (String str:missingStrings) {
@@ -144,7 +146,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=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA.InnerAspect</span>"));
+ missingStrings.contains("<pre>static class <span class=\"" + TYPE_NAME_LABEL + "\">ClassA.InnerAspect</span>"));
// get the html file for the enclosing class
File htmlFileClass = new File(getAbsolutePathOutdir() + "/foo/ClassA.html");
@@ -160,21 +162,21 @@ public class CoverageTestCase extends AjdocTestCase {
if (LangUtil.is13VMOrGreater()) {
classStrings = new String[] {
"Class ClassA</h1>",
- "public abstract class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>",
+ "public abstract class <span class=\"" + TYPE_NAME_LABEL + "\">ClassA</span>",
"Aspect ClassA</H2>",
- "public abstract aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>"};
+ "public abstract aspect <span class=\"" + TYPE_NAME_LABEL + "\">ClassA</span>"};
} else {
classStrings = new String[] {
"Class ClassA</h2>",
- "public abstract class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>",
+ "public abstract class <span class=\"" + TYPE_NAME_LABEL + "\">ClassA</span>",
"Aspect ClassA</H2>",
- "public abstract aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>"};
+ "public abstract aspect <span class=\"" + 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=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassA</span>"));
+ classMissing.contains("public abstract aspect <span class=\"" + TYPE_NAME_LABEL + "\">ClassA</span>"));
}
/**
@@ -657,9 +659,9 @@ public class CoverageTestCase extends AjdocTestCase {
String[] strings = null;
strings = new String[] {
"Aspect PkgVisibleClass.NestedAspect",
- "<pre>static aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass.NestedAspect</span>",
+ "<pre>static aspect <span class=\"" + TYPE_NAME_LABEL + "\">PkgVisibleClass.NestedAspect</span>",
"Class PkgVisibleClass.NestedAspect",
- "<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass.NestedAspect</span>"};
+ "<pre>static class <span class=\"" + TYPE_NAME_LABEL + "\">PkgVisibleClass.NestedAspect</span>"};
List<String> missingStrings = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings);
StringBuilder buf = new StringBuilder();
for (String str:missingStrings) {
@@ -669,7 +671,7 @@ public class CoverageTestCase extends AjdocTestCase {
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",
- missingStrings.contains("<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass.NestedAspect</span>"));
+ missingStrings.contains("<pre>static class <span class=\"" + TYPE_NAME_LABEL + "\">PkgVisibleClass.NestedAspect</span>"));
// get the html file for the enclosing class
File htmlFileClass = new File(getAbsolutePathOutdir() + "/PkgVisibleClass.html");
if (!htmlFileClass.exists()) {
@@ -683,22 +685,22 @@ public class CoverageTestCase extends AjdocTestCase {
if (LangUtil.is13VMOrGreater()) {
classStrings = new String[] {
"Class PkgVisibleClass</h1>",
- "<pre>class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>",
+ "<pre>class <span class=\"" + TYPE_NAME_LABEL + "\">PkgVisibleClass</span>",
"Aspect PkgVisibleClass</h2>",
- "<pre>aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>"};
+ "<pre>aspect <span class=\"" + TYPE_NAME_LABEL + "\">PkgVisibleClass</span>"};
} else {
classStrings = new String[] {
"Class PkgVisibleClass</h2>",
- "<pre>class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>",
+ "<pre>class <span class=\"" + TYPE_NAME_LABEL + "\">PkgVisibleClass</span>",
"Aspect PkgVisibleClass</h2>",
- "<pre>aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>"};
+ "<pre>aspect <span class=\"" + 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=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">PkgVisibleClass</span>"));
+ classMissing.contains("<pre>aspect <span class=\"" + TYPE_NAME_LABEL + "\">PkgVisibleClass</span>"));
}
/**
@@ -721,9 +723,9 @@ public class CoverageTestCase extends AjdocTestCase {
String[] strings = null;
strings = new String [] {
"Aspect ClassWithNestedAspect.NestedAspect",
- "<pre>static aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect.NestedAspect</span>",
+ "<pre>static aspect <span class=\"" + TYPE_NAME_LABEL + "\">ClassWithNestedAspect.NestedAspect</span>",
"Class ClassWithNestedAspect.NestedAspect",
- "<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect.NestedAspect</span>"};
+ "<pre>static class <span class=\"" + TYPE_NAME_LABEL + "\">ClassWithNestedAspect.NestedAspect</span>"};
List<String> missingStrings = AjdocOutputChecker.getMissingStringsInFile(htmlFile,strings);
StringBuilder buf = new StringBuilder();
for (String str:missingStrings) {
@@ -733,7 +735,7 @@ public class CoverageTestCase extends AjdocTestCase {
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",
- missingStrings.contains("<pre>static class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect.NestedAspect</span>"));
+ missingStrings.contains("<pre>static class <span class=\"" + TYPE_NAME_LABEL + "\">ClassWithNestedAspect.NestedAspect</span>"));
// get the html file for the enclosing class
File htmlFileClass = new File(getAbsolutePathOutdir() + "/pkg/ClassWithNestedAspect.html");
@@ -748,22 +750,22 @@ public class CoverageTestCase extends AjdocTestCase {
if (LangUtil.is13VMOrGreater()) {
classStrings = new String[] {
"Class ClassWithNestedAspect</h1>",
- "public class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>",
+ "public class <span class=\"" + TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>",
"Aspect ClassWithNestedAspect</h2>",
- "public aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>"};
+ "public aspect <span class=\"" + TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>"};
} else {
classStrings = new String[] {
"Class ClassWithNestedAspect</h2>",
- "public class <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>",
+ "public class <span class=\"" + TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>",
"Aspect ClassWithNestedAspect</h2>",
- "public aspect <span class=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>"};
+ "public aspect <span class=\"" + 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=\"" + HtmlDecorator.TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>"));
+ classMissing.contains("public aspect <span class=\"" + TYPE_NAME_LABEL + "\">ClassWithNestedAspect</span>"));
}
/**