Skip to content

Commit 5b370bb

Browse files
author
Martijn Dirkse
committed
Do not use FrankDocGroup annotation to test wrapper API
1 parent 19f1186 commit 5b370bb

File tree

6 files changed

+41
-16
lines changed

6 files changed

+41
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package org.frankframework.frankdoc.testtarget.doclet.interfaces.java5.annotation;
22

3-
import org.frankframework.doc.FrankDocGroup;
4-
53
/**
64
* @author martijn
75
*
86
*/
9-
@FrankDocGroup(name = "ClassGroup")
7+
@MyAnnotation(name = "ClassGroup")
108
public class ClassWithJava5Annotation implements InterfaceWithJavaDocTag {
119
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package org.frankframework.frankdoc.testtarget.doclet.interfaces.java5.annotation;
22

3-
import org.frankframework.doc.FrankDocGroup;
4-
53
/**
64
* @author martijn
75
*
86
*/
9-
@FrankDocGroup(name = "InterfaceGroup")
7+
@MyAnnotation(name = "InterfaceGroup")
108
public interface InterfaceWithJavaDocTag {
119
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
Copyright 2021 WeAreFrank!
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
package org.frankframework.frankdoc.testtarget.doclet.interfaces.java5.annotation;
17+
18+
import java.lang.annotation.Documented;
19+
import java.lang.annotation.Retention;
20+
import java.lang.annotation.RetentionPolicy;
21+
22+
@Documented
23+
@Retention(RetentionPolicy.RUNTIME)
24+
public @interface MyAnnotation {
25+
String name();
26+
int order() default Integer.MAX_VALUE;
27+
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package org.frankframework.frankdoc.testtarget.doclet.interfaces.java5.annotation;
22

3-
import org.frankframework.doc.FrankDocGroup;
4-
53
/**
64
* @author martijn
75
*
86
*/
9-
@FrankDocGroup(name = "ParentOverriderGroup")
7+
@MyAnnotation(name = "ParentOverriderGroup")
108
public class ParentOverrider extends ClassWithJava5Annotation implements InterfaceWithJavaDocTag {
119
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.frankframework.frankdoc.wrapper;
22

3+
import org.apache.logging.log4j.Logger;
4+
import org.frankframework.frankdoc.model.FrankElement;
5+
import org.frankframework.frankdoc.util.LogUtil;
36
import org.junit.jupiter.api.Test;
47

58
import javax.lang.model.element.Element;
@@ -9,16 +12,17 @@
912
import static org.junit.jupiter.api.Assertions.assertEquals;
1013

1114
public class EasyDocletTest {
15+
private static Logger log = LogUtil.getLogger(EasyDocletTest.class);
1216

1317
@Test
1418
public void test() throws Exception {
1519
Set<? extends Element> typeElements = TestUtil.getIncludedElements("org.frankframework.frankdoc.testtarget.doclet");
16-
assertEquals(50, typeElements.size());
17-
20+
log.info("Elements that are type elements:");
1821
for (Element element : typeElements) {
1922
if (element instanceof TypeElement) {
20-
System.out.println(((TypeElement) element).getQualifiedName().toString());
23+
log.info(" " + ((TypeElement) element).getQualifiedName().toString());
2124
}
2225
}
26+
assertEquals(51, typeElements.size());
2327
}
2428
}

frank-doc-doclet/src/test/java/org/frankframework/frankdoc/wrapper/FrankClassJava5AnnotationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
public class FrankClassJava5AnnotationTest {
1414
private static final String PACKAGE = "org.frankframework.frankdoc.testtarget.doclet.interfaces.java5.annotation.";
15-
15+
private static final String TEST_ANNOTATION = "org.frankframework.frankdoc.testtarget.doclet.interfaces.java5.annotation.MyAnnotation";
1616
public static Collection<Object[]> data() {
1717
return Arrays.asList(new Object[][] {
1818
{"ClassWithJava5Annotation", "ClassGroup"},
@@ -31,11 +31,11 @@ void testJavaAnnotationValue(String queriedClass, String expectedValue) throws E
3131
FrankClass instance = repository.findClass(PACKAGE + queriedClass);
3232
// TODO: Will rename this method and give it Java annotation class name as argument.
3333
// This has to be done for similar methods in FrankMethod as well.
34-
FrankAnnotation actualGroupAnnotation = instance.getAnnotationIncludingInherited(JAVADOC_GROUP_ANNOTATION);
34+
FrankAnnotation actualAnnotation = instance.getAnnotationIncludingInherited(TEST_ANNOTATION);
3535
if(expectedValue == null) {
36-
assertNull(actualGroupAnnotation);
36+
assertNull(actualAnnotation);
3737
} else {
38-
assertEquals(expectedValue, actualGroupAnnotation.getValueOf("name"));
38+
assertEquals(expectedValue, actualAnnotation.getValueOf("name"));
3939
}
4040
}
4141

0 commit comments

Comments
 (0)