();
+
+ protected ObjectFactory objectFactory = new ObjectFactory();
+
+ /**
+ * The entry point into parsing the javadoc.
+ *
+ * @param rootDoc The RootDoc intstance obtained via the doclet API
+ * @return The root node, containing everything parsed from javadoc doclet
+ */
+ public Root parseRootDoc(RootDoc rootDoc) {
+ Root rootNode = objectFactory.createRoot();
+
+ for (ClassDoc classDoc : rootDoc.classes()) {
+ PackageDoc packageDoc = classDoc.containingPackage();
+
+ Package packageNode = packages.get(packageDoc.name());
+ if (packageNode == null) {
+ packageNode = parsePackage(packageDoc);
+ packages.put(packageDoc.name(), packageNode);
+ rootNode.getPackage().add(packageNode);
+ }
+
+ if (classDoc instanceof AnnotationTypeDoc) {
+ packageNode.getAnnotation()
+ .add(parseAnnotationTypeDoc((AnnotationTypeDoc) classDoc));
+ } else if (classDoc.isEnum()) {
+ packageNode.getEnum().add(parseEnum(classDoc));
+ } else if (classDoc.isInterface()) {
+ packageNode.getInterface().add(parseInterface(classDoc));
+ } else {
+ packageNode.getClazz().add(parseClass(classDoc));
+ }
+ }
+
+ return rootNode;
+ }
+
+ protected Package parsePackage(PackageDoc packageDoc) {
+ Package packageNode = objectFactory.createPackage();
+ packageNode.setName(packageDoc.name());
+ String comment = packageDoc.commentText();
+ if (comment.length() > 0) {
+ packageNode.setComment(comment);
+ }
+
+ for (Tag tag : packageDoc.tags()) {
+ packageNode.getTag().add(parseTag(tag));
+ }
+
+ return packageNode;
+ }
+
+ /**
+ * Parse an annotation.
+ *
+ * @param annotationTypeDoc A AnnotationTypeDoc instance
+ * @return the annotation node
+ */
+ protected Annotation parseAnnotationTypeDoc(AnnotationTypeDoc annotationTypeDoc) {
+ Annotation annotationNode = objectFactory.createAnnotation();
+ annotationNode.setName(annotationTypeDoc.name());
+ annotationNode.setQualified(annotationTypeDoc.qualifiedName());
+ String comment = annotationTypeDoc.commentText();
+ if (comment.length() > 0) {
+ annotationNode.setComment(comment);
+ }
+ annotationNode.setIncluded(annotationTypeDoc.isIncluded());
+ annotationNode.setScope(parseScope(annotationTypeDoc));
+
+ for (AnnotationTypeElementDoc annotationTypeElementDoc : annotationTypeDoc.elements()) {
+ annotationNode.getElement()
+ .add(parseAnnotationTypeElementDoc(annotationTypeElementDoc));
+ }
+
+ for (AnnotationDesc annotationDesc : annotationTypeDoc.annotations()) {
+ annotationNode.getAnnotation()
+ .add(parseAnnotationDesc(annotationDesc, annotationTypeDoc.qualifiedName()));
+ }
+
+ for (Tag tag : annotationTypeDoc.tags()) {
+ annotationNode.getTag().add(parseTag(tag));
+ }
+
+ return annotationNode;
+ }
+
+ /**
+ * Parse the elements of an annotation
+ *
+ * @param annotationTypeElementDoc A AnnotationTypeElementDoc instance
+ * @return the annotation element node
+ */
+ protected AnnotationElement parseAnnotationTypeElementDoc(
+ AnnotationTypeElementDoc annotationTypeElementDoc) {
+ AnnotationElement annotationElementNode = objectFactory.createAnnotationElement();
+ annotationElementNode.setName(annotationTypeElementDoc.name());
+ annotationElementNode.setQualified(annotationTypeElementDoc.qualifiedName());
+ annotationElementNode.setType(parseTypeInfo(annotationTypeElementDoc.returnType()));
+
+ AnnotationValue value = annotationTypeElementDoc.defaultValue();
+ if (value != null) {
+ annotationElementNode.setDefault(value.toString());
+ }
+
+ return annotationElementNode;
+ }
+
+ /**
+ * Parses annotation instances of an annotable program element
+ *
+ * @param annotationDesc annotationDesc
+ * @param programElement programElement
+ * @return representation of annotations
+ */
+ protected AnnotationInstance parseAnnotationDesc(AnnotationDesc annotationDesc,
+ String programElement) {
+ AnnotationInstance annotationInstanceNode = objectFactory.createAnnotationInstance();
+
+ try {
+ AnnotationTypeDoc annotTypeInfo = annotationDesc.annotationType();
+ annotationInstanceNode.setName(annotTypeInfo.name());
+ annotationInstanceNode.setQualified(annotTypeInfo.qualifiedTypeName());
+ } catch (ClassCastException castException) {
+ LOGGER.error(
+ "Unable to obtain type data about an annotation found on: " + programElement);
+ LOGGER.error("Add to the classpath the class/jar that defines this annotation.");
+ }
+
+ for (AnnotationDesc.ElementValuePair elementValuesPair : annotationDesc.elementValues()) {
+ AnnotationArgument annotationArgumentNode = objectFactory.createAnnotationArgument();
+ annotationArgumentNode.setName(elementValuesPair.element().name());
+
+ Type annotationArgumentType = elementValuesPair.element().returnType();
+ annotationArgumentNode.setType(parseTypeInfo(annotationArgumentType));
+ annotationArgumentNode.setPrimitive(annotationArgumentType.isPrimitive());
+ annotationArgumentNode.setArray(annotationArgumentType.dimension().length() > 0);
+
+ Object objValue = elementValuesPair.value().value();
+ if (objValue instanceof AnnotationValue[]) {
+ for (AnnotationValue annotationValue : (AnnotationValue[]) objValue) {
+ if (annotationValue.value() instanceof AnnotationDesc) {
AnnotationDesc annoDesc = (AnnotationDesc) annotationValue.value();
- annotationArgumentNode.getAnnotation().add(parseAnnotationDesc(annoDesc, programElement));
+ annotationArgumentNode.getAnnotation()
+ .add(parseAnnotationDesc(annoDesc, programElement));
} else {
annotationArgumentNode.getValue().add(annotationValue.value().toString());
}
- }
- } else if (objValue instanceof FieldDoc) {
- annotationArgumentNode.getValue().add(((FieldDoc) objValue).name());
- } else if (objValue instanceof ClassDoc) {
- annotationArgumentNode.getValue().add(((ClassDoc) objValue).qualifiedTypeName());
- } else {
- annotationArgumentNode.getValue().add(objValue.toString());
- }
- annotationInstanceNode.getArgument().add(annotationArgumentNode);
- }
-
- return annotationInstanceNode;
- }
-
- protected Enum parseEnum(ClassDoc classDoc) {
- Enum enumNode = objectFactory.createEnum();
- enumNode.setName(classDoc.name());
- enumNode.setQualified(classDoc.qualifiedName());
- String comment = classDoc.commentText();
- if (comment.length() > 0) {
- enumNode.setComment(comment);
- }
- enumNode.setIncluded(classDoc.isIncluded());
- enumNode.setScope(parseScope(classDoc));
-
- Type superClassType = classDoc.superclassType();
- if (superClassType != null) {
- enumNode.setClazz(parseTypeInfo(superClassType));
- }
-
- for (Type interfaceType : classDoc.interfaceTypes()) {
- enumNode.getInterface().add(parseTypeInfo(interfaceType));
- }
-
- for (FieldDoc field : classDoc.enumConstants()) {
- enumNode.getConstant().add(parseEnumConstant(field));
- }
-
- for (AnnotationDesc annotationDesc : classDoc.annotations()) {
- enumNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
- }
-
- for (Tag tag : classDoc.tags()) {
- enumNode.getTag().add(parseTag(tag));
- }
-
- return enumNode;
- }
-
- /**
- * Parses an enum type definition
- *
- * @param fieldDoc
- * @return
- */
- protected EnumConstant parseEnumConstant(FieldDoc fieldDoc) {
- EnumConstant enumConstant = objectFactory.createEnumConstant();
- enumConstant.setName(fieldDoc.name());
- String comment = fieldDoc.commentText();
- if (comment.length() > 0) {
- enumConstant.setComment(comment);
- }
-
- for (AnnotationDesc annotationDesc : fieldDoc.annotations()) {
- enumConstant.getAnnotation().add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName()));
- }
-
- for (Tag tag : fieldDoc.tags()) {
- enumConstant.getTag().add(parseTag(tag));
- }
-
- return enumConstant;
- }
-
- protected Interface parseInterface(ClassDoc classDoc) {
-
- Interface interfaceNode = objectFactory.createInterface();
- interfaceNode.setName(classDoc.name());
- interfaceNode.setQualified(classDoc.qualifiedName());
- String comment = classDoc.commentText();
- if (comment.length() > 0) {
- interfaceNode.setComment(comment);
- }
- interfaceNode.setIncluded(classDoc.isIncluded());
- interfaceNode.setScope(parseScope(classDoc));
-
- for (TypeVariable typeVariable : classDoc.typeParameters()) {
- interfaceNode.getGeneric().add(parseTypeParameter(typeVariable));
- }
-
- for (Type interfaceType : classDoc.interfaceTypes()) {
- interfaceNode.getInterface().add(parseTypeInfo(interfaceType));
- }
-
- for (MethodDoc method : classDoc.methods()) {
- interfaceNode.getMethod().add(parseMethod(method));
- }
-
- for (AnnotationDesc annotationDesc : classDoc.annotations()) {
- interfaceNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
- }
-
- for (Tag tag : classDoc.tags()) {
- interfaceNode.getTag().add(parseTag(tag));
- }
-
- for (FieldDoc field : classDoc.fields()) {
- interfaceNode.getField().add(parseField(field));
- }
-
- return interfaceNode;
- }
-
- protected Class parseClass(ClassDoc classDoc) {
-
- Class classNode = objectFactory.createClass();
- classNode.setName(classDoc.name());
- classNode.setQualified(classDoc.qualifiedName());
- String comment = classDoc.commentText();
- if (comment.length() > 0) {
- classNode.setComment(comment);
- }
- classNode.setAbstract(classDoc.isAbstract());
- classNode.setError(classDoc.isError());
- classNode.setException(classDoc.isException());
- classNode.setExternalizable(classDoc.isExternalizable());
- classNode.setIncluded(classDoc.isIncluded());
- classNode.setSerializable(classDoc.isSerializable());
- classNode.setScope(parseScope(classDoc));
-
- for (TypeVariable typeVariable : classDoc.typeParameters()) {
- classNode.getGeneric().add(parseTypeParameter(typeVariable));
- }
-
- Type superClassType = classDoc.superclassType();
- if (superClassType != null) {
- classNode.setClazz(parseTypeInfo(superClassType));
- }
-
- for (Type interfaceType : classDoc.interfaceTypes()) {
- classNode.getInterface().add(parseTypeInfo(interfaceType));
- }
-
- for (MethodDoc method : classDoc.methods()) {
- classNode.getMethod().add(parseMethod(method));
- }
-
- for (AnnotationDesc annotationDesc : classDoc.annotations()) {
- classNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
- }
-
- for (ConstructorDoc constructor : classDoc.constructors()) {
- classNode.getConstructor().add(parseConstructor(constructor));
- }
-
- for (FieldDoc field : classDoc.fields()) {
- classNode.getField().add(parseField(field));
- }
-
- for (Tag tag : classDoc.tags()) {
- classNode.getTag().add(parseTag(tag));
- }
-
- return classNode;
- }
-
- protected Constructor parseConstructor(ConstructorDoc constructorDoc) {
- Constructor constructorNode = objectFactory.createConstructor();
-
- constructorNode.setName(constructorDoc.name());
- constructorNode.setQualified(constructorDoc.qualifiedName());
- String comment = constructorDoc.commentText();
- if (comment.length() > 0) {
- constructorNode.setComment(comment);
- }
- constructorNode.setScope(parseScope(constructorDoc));
- constructorNode.setIncluded(constructorDoc.isIncluded());
- constructorNode.setFinal(constructorDoc.isFinal());
- constructorNode.setNative(constructorDoc.isNative());
- constructorNode.setStatic(constructorDoc.isStatic());
- constructorNode.setSynchronized(constructorDoc.isSynchronized());
- constructorNode.setVarArgs(constructorDoc.isVarArgs());
- constructorNode.setSignature(constructorDoc.signature());
-
- for (Parameter parameter : constructorDoc.parameters()) {
- constructorNode.getParameter().add(parseMethodParameter(parameter));
- }
-
- for (Type exceptionType : constructorDoc.thrownExceptionTypes()) {
- constructorNode.getException().add(parseTypeInfo(exceptionType));
- }
-
- for (AnnotationDesc annotationDesc : constructorDoc.annotations()) {
- constructorNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, constructorDoc.qualifiedName()));
- }
-
- for (Tag tag : constructorDoc.tags()) {
- constructorNode.getTag().add(parseTag(tag));
- }
-
- return constructorNode;
- }
-
- protected Method parseMethod(MethodDoc methodDoc) {
- Method methodNode = objectFactory.createMethod();
-
- methodNode.setName(methodDoc.name());
- methodNode.setQualified(methodDoc.qualifiedName());
- String comment = methodDoc.commentText();
- if (comment.length() > 0) {
- methodNode.setComment(comment);
- }
- methodNode.setScope(parseScope(methodDoc));
- methodNode.setAbstract(methodDoc.isAbstract());
- methodNode.setIncluded(methodDoc.isIncluded());
- methodNode.setFinal(methodDoc.isFinal());
- methodNode.setNative(methodDoc.isNative());
- methodNode.setStatic(methodDoc.isStatic());
- methodNode.setSynchronized(methodDoc.isSynchronized());
- methodNode.setVarArgs(methodDoc.isVarArgs());
- methodNode.setSignature(methodDoc.signature());
- methodNode.setReturn(parseTypeInfo(methodDoc.returnType()));
-
- for (Parameter parameter : methodDoc.parameters()) {
- methodNode.getParameter().add(parseMethodParameter(parameter));
- }
-
- for (Type exceptionType : methodDoc.thrownExceptionTypes()) {
- methodNode.getException().add(parseTypeInfo(exceptionType));
- }
-
- for (AnnotationDesc annotationDesc : methodDoc.annotations()) {
- methodNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, methodDoc.qualifiedName()));
- }
-
- for (Tag tag : methodDoc.tags()) {
- methodNode.getTag().add(parseTag(tag));
- }
-
- return methodNode;
- }
-
- protected MethodParameter parseMethodParameter(Parameter parameter) {
- MethodParameter parameterMethodNode = objectFactory.createMethodParameter();
- parameterMethodNode.setName(parameter.name());
- parameterMethodNode.setType(parseTypeInfo(parameter.type()));
-
- for (AnnotationDesc annotationDesc : parameter.annotations()) {
- parameterMethodNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, parameter.typeName()));
- }
-
- return parameterMethodNode;
- }
-
- protected Field parseField(FieldDoc fieldDoc) {
- Field fieldNode = objectFactory.createField();
- fieldNode.setType(parseTypeInfo(fieldDoc.type()));
- fieldNode.setName(fieldDoc.name());
- fieldNode.setQualified(fieldDoc.qualifiedName());
- String comment = fieldDoc.commentText();
- if (comment.length() > 0) {
- fieldNode.setComment(comment);
- }
- fieldNode.setScope(parseScope(fieldDoc));
- fieldNode.setFinal(fieldDoc.isFinal());
- fieldNode.setStatic(fieldDoc.isStatic());
- fieldNode.setVolatile(fieldDoc.isVolatile());
- fieldNode.setTransient(fieldDoc.isTransient());
- fieldNode.setConstant(fieldDoc.constantValueExpression());
-
- for (AnnotationDesc annotationDesc : fieldDoc.annotations()) {
- fieldNode.getAnnotation().add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName()));
- }
-
- for (Tag tag : fieldDoc.tags()) {
- fieldNode.getTag().add(parseTag(tag));
- }
-
- return fieldNode;
- }
-
- protected TypeInfo parseTypeInfo(Type type) {
- TypeInfo typeInfoNode = objectFactory.createTypeInfo();
- typeInfoNode.setQualified(type.qualifiedTypeName());
- String dimension = type.dimension();
- if (dimension.length() > 0) {
- typeInfoNode.setDimension(dimension);
- }
-
- WildcardType wildcard = type.asWildcardType();
- if (wildcard != null) {
- typeInfoNode.setWildcard(parseWildcard(wildcard));
- }
-
- ParameterizedType parameterized = type.asParameterizedType();
- if (parameterized != null) {
- for (Type typeArgument : parameterized.typeArguments()) {
- typeInfoNode.getGeneric().add(parseTypeInfo(typeArgument));
- }
- }
-
- return typeInfoNode;
- }
-
- protected Wildcard parseWildcard(WildcardType wildcard) {
- Wildcard wildcardNode = objectFactory.createWildcard();
-
- for (Type extendType : wildcard.extendsBounds()) {
- wildcardNode.getExtendsBound().add(parseTypeInfo(extendType));
- }
-
- for (Type superType : wildcard.superBounds()) {
- wildcardNode.getSuperBound().add(parseTypeInfo(superType));
- }
-
- return wildcardNode;
- }
-
- /**
- * Parse type variables for generics
- *
- * @param typeVariable
- * @return
- */
- protected TypeParameter parseTypeParameter(TypeVariable typeVariable) {
- TypeParameter typeParameter = objectFactory.createTypeParameter();
- typeParameter.setName(typeVariable.typeName());
-
- for (Type bound : typeVariable.bounds()) {
- typeParameter.getBound().add(bound.qualifiedTypeName());
- }
-
- return typeParameter;
- }
-
- protected TagInfo parseTag(Tag tagDoc) {
- TagInfo tagNode = objectFactory.createTagInfo();
- tagNode.setName(tagDoc.kind());
- tagNode.setText(tagDoc.text());
- return tagNode;
- }
-
- /**
- * Returns string representation of scope
- *
- * @param doc
- * @return
- */
- protected String parseScope(ProgramElementDoc doc) {
- if (doc.isPrivate()) {
- return "private";
- } else if (doc.isProtected()) {
- return "protected";
- } else if (doc.isPublic()) {
- return "public";
- }
- return "";
- }
+ }
+ } else if (objValue instanceof FieldDoc) {
+ annotationArgumentNode.getValue().add(((FieldDoc) objValue).name());
+ } else if (objValue instanceof ClassDoc) {
+ annotationArgumentNode.getValue().add(((ClassDoc) objValue).qualifiedTypeName());
+ } else {
+ annotationArgumentNode.getValue().add(objValue.toString());
+ }
+ annotationInstanceNode.getArgument().add(annotationArgumentNode);
+ }
+
+ return annotationInstanceNode;
+ }
+
+ protected Enum parseEnum(ClassDoc classDoc) {
+ Enum enumNode = objectFactory.createEnum();
+ enumNode.setName(classDoc.name());
+ enumNode.setQualified(classDoc.qualifiedName());
+ String comment = classDoc.commentText();
+ if (comment.length() > 0) {
+ enumNode.setComment(comment);
+ }
+ enumNode.setIncluded(classDoc.isIncluded());
+ enumNode.setScope(parseScope(classDoc));
+
+ Type superClassType = classDoc.superclassType();
+ if (superClassType != null) {
+ enumNode.setClazz(parseTypeInfo(superClassType));
+ }
+
+ for (Type interfaceType : classDoc.interfaceTypes()) {
+ enumNode.getInterface().add(parseTypeInfo(interfaceType));
+ }
+
+ for (FieldDoc field : classDoc.enumConstants()) {
+ enumNode.getConstant().add(parseEnumConstant(field));
+ }
+
+ for (AnnotationDesc annotationDesc : classDoc.annotations()) {
+ enumNode.getAnnotation()
+ .add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
+ }
+
+ for (Tag tag : classDoc.tags()) {
+ enumNode.getTag().add(parseTag(tag));
+ }
+
+ return enumNode;
+ }
+
+ /**
+ * Parses an enum type definition
+ *
+ * @param fieldDoc
+ * @return
+ */
+ protected EnumConstant parseEnumConstant(FieldDoc fieldDoc) {
+ EnumConstant enumConstant = objectFactory.createEnumConstant();
+ enumConstant.setName(fieldDoc.name());
+ String comment = fieldDoc.commentText();
+ if (comment.length() > 0) {
+ enumConstant.setComment(comment);
+ }
+
+ for (AnnotationDesc annotationDesc : fieldDoc.annotations()) {
+ enumConstant.getAnnotation()
+ .add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName()));
+ }
+
+ for (Tag tag : fieldDoc.tags()) {
+ enumConstant.getTag().add(parseTag(tag));
+ }
+
+ return enumConstant;
+ }
+
+ protected Interface parseInterface(ClassDoc classDoc) {
+
+ Interface interfaceNode = objectFactory.createInterface();
+ interfaceNode.setName(classDoc.name());
+ interfaceNode.setQualified(classDoc.qualifiedName());
+ String comment = classDoc.commentText();
+ if (comment.length() > 0) {
+ interfaceNode.setComment(comment);
+ }
+ interfaceNode.setIncluded(classDoc.isIncluded());
+ interfaceNode.setScope(parseScope(classDoc));
+
+ for (TypeVariable typeVariable : classDoc.typeParameters()) {
+ interfaceNode.getGeneric().add(parseTypeParameter(typeVariable));
+ }
+
+ for (Type interfaceType : classDoc.interfaceTypes()) {
+ interfaceNode.getInterface().add(parseTypeInfo(interfaceType));
+ }
+
+ for (MethodDoc method : classDoc.methods()) {
+ interfaceNode.getMethod().add(parseMethod(method));
+ }
+
+ for (AnnotationDesc annotationDesc : classDoc.annotations()) {
+ interfaceNode.getAnnotation()
+ .add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
+ }
+
+ for (Tag tag : classDoc.tags()) {
+ interfaceNode.getTag().add(parseTag(tag));
+ }
+
+ for (FieldDoc field : classDoc.fields()) {
+ interfaceNode.getField().add(parseField(field));
+ }
+
+ return interfaceNode;
+ }
+
+ protected Class parseClass(ClassDoc classDoc) {
+
+ Class classNode = objectFactory.createClass();
+ classNode.setName(classDoc.name());
+ classNode.setQualified(classDoc.qualifiedName());
+ String comment = classDoc.commentText();
+ if (comment.length() > 0) {
+ classNode.setComment(comment);
+ }
+ classNode.setAbstract(classDoc.isAbstract());
+ classNode.setError(classDoc.isError());
+ classNode.setException(classDoc.isException());
+ classNode.setExternalizable(classDoc.isExternalizable());
+ classNode.setIncluded(classDoc.isIncluded());
+ classNode.setSerializable(classDoc.isSerializable());
+ classNode.setScope(parseScope(classDoc));
+
+ for (TypeVariable typeVariable : classDoc.typeParameters()) {
+ classNode.getGeneric().add(parseTypeParameter(typeVariable));
+ }
+
+ Type superClassType = classDoc.superclassType();
+ if (superClassType != null) {
+ classNode.setClazz(parseTypeInfo(superClassType));
+ }
+
+ for (Type interfaceType : classDoc.interfaceTypes()) {
+ classNode.getInterface().add(parseTypeInfo(interfaceType));
+ }
+
+ for (MethodDoc method : classDoc.methods()) {
+ classNode.getMethod().add(parseMethod(method));
+ }
+
+ for (AnnotationDesc annotationDesc : classDoc.annotations()) {
+ classNode.getAnnotation()
+ .add(parseAnnotationDesc(annotationDesc, classDoc.qualifiedName()));
+ }
+
+ for (ConstructorDoc constructor : classDoc.constructors()) {
+ classNode.getConstructor().add(parseConstructor(constructor));
+ }
+
+ for (FieldDoc field : classDoc.fields()) {
+ classNode.getField().add(parseField(field));
+ }
+
+ for (Tag tag : classDoc.tags()) {
+ classNode.getTag().add(parseTag(tag));
+ }
+
+ return classNode;
+ }
+
+ protected Constructor parseConstructor(ConstructorDoc constructorDoc) {
+ Constructor constructorNode = objectFactory.createConstructor();
+
+ constructorNode.setName(constructorDoc.name());
+ constructorNode.setQualified(constructorDoc.qualifiedName());
+ String comment = constructorDoc.commentText();
+ if (comment.length() > 0) {
+ constructorNode.setComment(comment);
+ }
+ constructorNode.setScope(parseScope(constructorDoc));
+ constructorNode.setIncluded(constructorDoc.isIncluded());
+ constructorNode.setFinal(constructorDoc.isFinal());
+ constructorNode.setNative(constructorDoc.isNative());
+ constructorNode.setStatic(constructorDoc.isStatic());
+ constructorNode.setSynchronized(constructorDoc.isSynchronized());
+ constructorNode.setVarArgs(constructorDoc.isVarArgs());
+ constructorNode.setSignature(constructorDoc.signature());
+
+ for (Parameter parameter : constructorDoc.parameters()) {
+ constructorNode.getParameter().add(parseMethodParameter(parameter));
+ }
+
+ for (Type exceptionType : constructorDoc.thrownExceptionTypes()) {
+ constructorNode.getException().add(parseTypeInfo(exceptionType));
+ }
+
+ for (AnnotationDesc annotationDesc : constructorDoc.annotations()) {
+ constructorNode.getAnnotation()
+ .add(parseAnnotationDesc(annotationDesc, constructorDoc.qualifiedName()));
+ }
+
+ for (Tag tag : constructorDoc.tags()) {
+ constructorNode.getTag().add(parseTag(tag));
+ }
+
+ return constructorNode;
+ }
+
+ protected Method parseMethod(MethodDoc methodDoc) {
+ Method methodNode = objectFactory.createMethod();
+
+ methodNode.setName(methodDoc.name());
+ methodNode.setQualified(methodDoc.qualifiedName());
+ String comment = methodDoc.commentText();
+ if (comment.length() > 0) {
+ methodNode.setComment(comment);
+ }
+ methodNode.setScope(parseScope(methodDoc));
+ methodNode.setAbstract(methodDoc.isAbstract());
+ methodNode.setIncluded(methodDoc.isIncluded());
+ methodNode.setFinal(methodDoc.isFinal());
+ methodNode.setNative(methodDoc.isNative());
+ methodNode.setStatic(methodDoc.isStatic());
+ methodNode.setSynchronized(methodDoc.isSynchronized());
+ methodNode.setVarArgs(methodDoc.isVarArgs());
+ methodNode.setSignature(methodDoc.signature());
+ methodNode.setReturn(parseTypeInfo(methodDoc.returnType()));
+
+ for (Parameter parameter : methodDoc.parameters()) {
+ methodNode.getParameter().add(parseMethodParameter(parameter));
+ }
+
+ for (Type exceptionType : methodDoc.thrownExceptionTypes()) {
+ methodNode.getException().add(parseTypeInfo(exceptionType));
+ }
+
+ for (AnnotationDesc annotationDesc : methodDoc.annotations()) {
+ methodNode.getAnnotation()
+ .add(parseAnnotationDesc(annotationDesc, methodDoc.qualifiedName()));
+ }
+
+ for (Tag tag : methodDoc.tags()) {
+ methodNode.getTag().add(parseTag(tag));
+ }
+
+ return methodNode;
+ }
+
+ protected MethodParameter parseMethodParameter(Parameter parameter) {
+ MethodParameter parameterMethodNode = objectFactory.createMethodParameter();
+ parameterMethodNode.setName(parameter.name());
+ parameterMethodNode.setType(parseTypeInfo(parameter.type()));
+
+ for (AnnotationDesc annotationDesc : parameter.annotations()) {
+ parameterMethodNode.getAnnotation()
+ .add(parseAnnotationDesc(annotationDesc, parameter.typeName()));
+ }
+
+ return parameterMethodNode;
+ }
+
+ protected Field parseField(FieldDoc fieldDoc) {
+ Field fieldNode = objectFactory.createField();
+ fieldNode.setType(parseTypeInfo(fieldDoc.type()));
+ fieldNode.setName(fieldDoc.name());
+ fieldNode.setQualified(fieldDoc.qualifiedName());
+ String comment = fieldDoc.commentText();
+ if (comment.length() > 0) {
+ fieldNode.setComment(comment);
+ }
+ fieldNode.setScope(parseScope(fieldDoc));
+ fieldNode.setFinal(fieldDoc.isFinal());
+ fieldNode.setStatic(fieldDoc.isStatic());
+ fieldNode.setVolatile(fieldDoc.isVolatile());
+ fieldNode.setTransient(fieldDoc.isTransient());
+ fieldNode.setConstant(fieldDoc.constantValueExpression());
+
+ for (AnnotationDesc annotationDesc : fieldDoc.annotations()) {
+ fieldNode.getAnnotation()
+ .add(parseAnnotationDesc(annotationDesc, fieldDoc.qualifiedName()));
+ }
+
+ for (Tag tag : fieldDoc.tags()) {
+ fieldNode.getTag().add(parseTag(tag));
+ }
+
+ return fieldNode;
+ }
+
+ protected TypeInfo parseTypeInfo(Type type) {
+ TypeInfo typeInfoNode = objectFactory.createTypeInfo();
+ typeInfoNode.setQualified(type.qualifiedTypeName());
+ String dimension = type.dimension();
+ if (dimension.length() > 0) {
+ typeInfoNode.setDimension(dimension);
+ }
+
+ WildcardType wildcard = type.asWildcardType();
+ if (wildcard != null) {
+ typeInfoNode.setWildcard(parseWildcard(wildcard));
+ }
+
+ ParameterizedType parameterized = type.asParameterizedType();
+ if (parameterized != null) {
+ for (Type typeArgument : parameterized.typeArguments()) {
+ typeInfoNode.getGeneric().add(parseTypeInfo(typeArgument));
+ }
+ }
+
+ return typeInfoNode;
+ }
+
+ protected Wildcard parseWildcard(WildcardType wildcard) {
+ Wildcard wildcardNode = objectFactory.createWildcard();
+
+ for (Type extendType : wildcard.extendsBounds()) {
+ wildcardNode.getExtendsBound().add(parseTypeInfo(extendType));
+ }
+
+ for (Type superType : wildcard.superBounds()) {
+ wildcardNode.getSuperBound().add(parseTypeInfo(superType));
+ }
+
+ return wildcardNode;
+ }
+
+ /**
+ * Parse type variables for generics
+ *
+ * @param typeVariable
+ * @return
+ */
+ protected TypeParameter parseTypeParameter(TypeVariable typeVariable) {
+ TypeParameter typeParameter = objectFactory.createTypeParameter();
+ typeParameter.setName(typeVariable.typeName());
+
+ for (Type bound : typeVariable.bounds()) {
+ typeParameter.getBound().add(bound.qualifiedTypeName());
+ }
+
+ return typeParameter;
+ }
+
+ protected TagInfo parseTag(Tag tagDoc) {
+ TagInfo tagNode = objectFactory.createTagInfo();
+ tagNode.setName(tagDoc.kind());
+ tagNode.setText(tagDoc.text());
+ return tagNode;
+ }
+
+ /**
+ * Returns string representation of scope
+ *
+ * @param doc
+ * @return
+ */
+ protected String parseScope(ProgramElementDoc doc) {
+ if (doc.isPrivate()) {
+ return "private";
+ } else if (doc.isProtected()) {
+ return "protected";
+ } else if (doc.isPublic()) {
+ return "public";
+ }
+ return "";
+ }
}
diff --git a/src/main/java/com/github/markusbernhardt/xmldoclet/XmlDoclet.java b/src/main/java/com/github/markusbernhardt/xmldoclet/XmlDoclet.java
index 99b029e..5bd296f 100644
--- a/src/main/java/com/github/markusbernhardt/xmldoclet/XmlDoclet.java
+++ b/src/main/java/com/github/markusbernhardt/xmldoclet/XmlDoclet.java
@@ -6,6 +6,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -38,224 +39,218 @@
*/
public class XmlDoclet {
- private final static Logger log = LoggerFactory.getLogger(Parser.class);
+ private final static Logger LOGGER = LoggerFactory.getLogger(Parser.class);
- /**
- * The parsed object model. Used in unit tests.
- */
- public static Root root;
+ /**
+ * The parsed object model. Used in unit tests.
+ */
+ public static Root root;
- /**
- * The Options instance to parse command line strings.
- */
- public final static Options options;
+ /**
+ * The Options instance to parse command line strings.
+ */
+ public final static Options OPTIONS;
- static {
- options = new Options();
+ static {
+ OPTIONS = new Options();
- OptionBuilder.withArgName("directory");
- OptionBuilder.isRequired(false);
- OptionBuilder.hasArg();
- OptionBuilder.withDescription("Destination directory for output file.\nDefault: .");
- options.addOption(OptionBuilder.create("d"));
+ OptionBuilder.withArgName("directory");
+ OptionBuilder.isRequired(false);
+ OptionBuilder.hasArg();
+ OptionBuilder.withDescription("Destination directory for output file.\nDefault: .");
+ OPTIONS.addOption(OptionBuilder.create("d"));
- OptionBuilder.withArgName("encoding");
- OptionBuilder.isRequired(false);
- OptionBuilder.hasArg();
- OptionBuilder.withDescription("Encoding of the output file.\nDefault: UTF8");
- options.addOption(OptionBuilder.create("docencoding"));
+ OptionBuilder.withArgName("encoding");
+ OptionBuilder.isRequired(false);
+ OptionBuilder.hasArg();
+ OptionBuilder.withDescription("Encoding of the output file.\nDefault: UTF8");
+ OPTIONS.addOption(OptionBuilder.create("docencoding"));
- OptionBuilder.withArgName("dryrun");
- OptionBuilder.isRequired(false);
- OptionBuilder.hasArgs(0);
- OptionBuilder.withDescription("Parse javadoc, but don't write output file.\nDefault: false");
- options.addOption(OptionBuilder.create("dryrun"));
+ OptionBuilder.withArgName("dryrun");
+ OptionBuilder.isRequired(false);
+ OptionBuilder.hasArgs(0);
+ OptionBuilder
+ .withDescription("Parse javadoc, but don't write output file.\nDefault: false");
+ OPTIONS.addOption(OptionBuilder.create("dryrun"));
- OptionBuilder.withArgName("filename");
- OptionBuilder.isRequired(false);
- OptionBuilder.hasArg();
- OptionBuilder.withDescription("Name of the output file.\nDefault: javadoc.xml");
- options.addOption(OptionBuilder.create("filename"));
- }
+ OptionBuilder.withArgName("filename");
+ OptionBuilder.isRequired(false);
+ OptionBuilder.hasArg();
+ OptionBuilder.withDescription("Name of the output file.\nDefault: javadoc.xml");
+ OPTIONS.addOption(OptionBuilder.create("filename"));
+ }
- /**
- * Check for doclet-added options. Returns the number of arguments you must
- * specify on the command line for the given option. For example, "-d docs"
- * would return 2.
- *
- * This method is required if the doclet contains any options. If this
- * method is missing, Javadoc will print an invalid flag error for every
- * option.
- *
- * @see com.sun.javadoc.Doclet#optionLength(String)
- *
- * @param optionName
- * The name of the option.
- * @return number of arguments on the command line for an option including
- * the option name itself. Zero return means option not known.
- * Negative value means error occurred.
- */
- public static int optionLength(String optionName) {
- Option option = options.getOption(optionName);
- if (option == null) {
- return 0;
- }
- return option.getArgs() + 1;
- }
+ /**
+ * Check for doclet-added options. Returns the number of arguments you must specify on the
+ * command line for the given option. For example, "-d docs" would return 2.
+ *
+ * This method is required if the doclet contains any options. If this method is missing,
+ * Javadoc will print an invalid flag error for every option.
+ *
+ * @see com.sun.javadoc.Doclet#optionLength(String)
+ *
+ * @param optionName The name of the option.
+ * @return number of arguments on the command line for an option including the option name
+ * itself. Zero return means option not known. Negative value means error occurred.
+ */
+ public static int optionLength(String optionName) {
+ Option option = OPTIONS.getOption(optionName);
+ if (option == null) {
+ return 0;
+ }
+ return option.getArgs() + 1;
+ }
- /**
- * Check that options have the correct arguments.
- *
- * This method is not required, but is recommended, as every option will be
- * considered valid if this method is not present. It will default
- * gracefully (to true) if absent.
- *
- * Printing option related error messages (using the provided
- * DocErrorReporter) is the responsibility of this method.
- *
- * @see com.sun.javadoc.Doclet#validOptions(String[][], DocErrorReporter)
- *
- * @param optionsArrayArray
- * The two dimensional array of options.
- * @param reporter
- * The error reporter.
- *
- * @return true
if the options are valid.
- */
- public static boolean validOptions(String optionsArrayArray[][], DocErrorReporter reporter) {
- return null != parseCommandLine(optionsArrayArray);
- }
+ /**
+ * Check that options have the correct arguments.
+ *
+ * This method is not required, but is recommended, as every option will be considered valid if
+ * this method is not present. It will default gracefully (to true) if absent.
+ *
+ * Printing option related error messages (using the provided DocErrorReporter) is the
+ * responsibility of this method.
+ *
+ * @see com.sun.javadoc.Doclet#validOptions(String[][], DocErrorReporter)
+ *
+ * @param optionsArrayArray The two dimensional array of options.
+ * @param reporter The error reporter.
+ *
+ * @return true
if the options are valid.
+ */
+ public static boolean validOptions(String optionsArrayArray[][], DocErrorReporter reporter) {
+ return null != parseCommandLine(optionsArrayArray);
+ }
- /**
- * Processes the JavaDoc documentation.
- *
- * This method is required for all doclets.
- *
- * @see com.sun.javadoc.Doclet#start(RootDoc)
- *
- * @param rootDoc
- * The root of the documentation tree.
- *
- * @return true
if processing was successful.
- */
- public static boolean start(RootDoc rootDoc) {
- CommandLine commandLine = parseCommandLine(rootDoc.options());
- Parser parser = new Parser();
- root = parser.parseRootDoc(rootDoc);
- save(commandLine, root);
- return true;
- }
+ /**
+ * Processes the JavaDoc documentation.
+ *
+ * This method is required for all doclets.
+ *
+ * @see com.sun.javadoc.Doclet#start(RootDoc)
+ *
+ * @param rootDoc The root of the documentation tree.
+ *
+ * @return true
if processing was successful.
+ */
+ public static boolean start(RootDoc rootDoc) {
+ CommandLine commandLine = parseCommandLine(rootDoc.options());
+ Parser parser = new Parser();
+ root = parser.parseRootDoc(rootDoc);
+ save(commandLine, root);
+ return true;
+ }
- /**
- * Save XML object model to a file via JAXB.
- *
- * @param commandLine
- * the parsed command line arguments
- * @param root
- * the document root
- */
- public static void save(CommandLine commandLine, Root root) {
- if (commandLine.hasOption("dryrun")) {
- return;
- }
+ /**
+ * Save XML object model to a file via JAXB.
+ *
+ * @param commandLine the parsed command line arguments
+ * @param root the document root
+ */
+ public static void save(CommandLine commandLine, Root root) {
+ if (commandLine.hasOption("dryrun")) {
+ return;
+ }
- FileOutputStream fileOutputStream = null;
- BufferedOutputStream bufferedOutputStream = null;
- try {
- JAXBContext contextObj = JAXBContext.newInstance(Root.class);
+ FileOutputStream fileOutputStream = null;
+ BufferedOutputStream bufferedOutputStream = null;
+ try {
+ JAXBContext contextObj = JAXBContext.newInstance(Root.class);
- Marshaller marshaller = contextObj.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- if (commandLine.hasOption("docencoding")) {
- marshaller.setProperty(Marshaller.JAXB_ENCODING, commandLine.getOptionValue("docencoding"));
- }
+ Marshaller marshaller = contextObj.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ if (commandLine.hasOption("docencoding")) {
+ marshaller.setProperty(Marshaller.JAXB_ENCODING,
+ commandLine.getOptionValue("docencoding"));
+ }
- String filename = "javadoc.xml";
- if (commandLine.hasOption("filename")) {
- filename = commandLine.getOptionValue("filename");
- }
- if (commandLine.hasOption("d")) {
- filename = commandLine.getOptionValue("d") + File.separator + filename;
- }
+ String filename = "javadoc.xml";
+ if (commandLine.hasOption("filename")) {
+ filename = commandLine.getOptionValue("filename");
+ }
+ if (commandLine.hasOption("d")) {
+ filename = commandLine.getOptionValue("d") + File.separator + filename;
+ }
- fileOutputStream = new FileOutputStream(filename);
- bufferedOutputStream = new BufferedOutputStream(fileOutputStream, 1024 * 1024);
+ fileOutputStream = new FileOutputStream(filename);
+ bufferedOutputStream = new BufferedOutputStream(fileOutputStream, 1024 * 1024);
- marshaller.marshal(root, bufferedOutputStream);
- bufferedOutputStream.flush();
- fileOutputStream.flush();
+ marshaller.marshal(root, bufferedOutputStream);
+ bufferedOutputStream.flush();
+ fileOutputStream.flush();
- } catch (JAXBException e) {
- log.error(e.getMessage(), e);
- } catch (FileNotFoundException e) {
- log.error(e.getMessage(), e);
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- } finally {
- try {
- if (bufferedOutputStream != null) {
- bufferedOutputStream.close();
- }
- if (fileOutputStream != null) {
- fileOutputStream.close();
- }
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- }
- }
- }
+ } catch (JAXBException e) {
+ LOGGER.error(e.getMessage(), e);
+ } catch (FileNotFoundException e) {
+ LOGGER.error(e.getMessage(), e);
+ } catch (IOException e) {
+ LOGGER.error(e.getMessage(), e);
+ } finally {
+ try {
+ if (bufferedOutputStream != null) {
+ bufferedOutputStream.close();
+ }
+ if (fileOutputStream != null) {
+ fileOutputStream.close();
+ }
+ } catch (IOException e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+ }
- /**
- * Return the version of the Java Programming Language supported by this
- * doclet.
- *
- * This method is required by any doclet supporting a language version newer
- * than 1.1.
- *
- * This Doclet supports Java 5.
- *
- * @see com.sun.javadoc.Doclet#languageVersion()
- *
- * @return LanguageVersion#JAVA_1_5
- */
- public static LanguageVersion languageVersion() {
- return LanguageVersion.JAVA_1_5;
- }
+ /**
+ * Return the version of the Java Programming Language supported by this doclet.
+ *
+ * This method is required by any doclet supporting a language version newer than 1.1.
+ *
+ * This Doclet supports Java 5.
+ *
+ * @see com.sun.javadoc.Doclet#languageVersion()
+ *
+ * @return LanguageVersion#JAVA_1_5
+ */
+ public static LanguageVersion languageVersion() {
+ return LanguageVersion.JAVA_1_5;
+ }
- /**
- * Parse the given options.
- *
- * @param optionsArrayArray
- * The two dimensional array of options.
- * @return the parsed command line arguments.
- */
- public static CommandLine parseCommandLine(String[][] optionsArrayArray) {
- try {
- List argumentList = new ArrayList();
- for (String[] optionsArray : optionsArrayArray) {
- argumentList.addAll(Arrays.asList(optionsArray));
- }
+ /**
+ * Parse the given options.
+ *
+ * @param optionsArrayArray The two dimensional array of options.
+ * @return the parsed command line arguments.
+ */
+ public static CommandLine parseCommandLine(String[][] optionsArrayArray) {
+ try {
+ List argumentList = new ArrayList();
+ for (String[] optionsArray : optionsArrayArray) {
+ argumentList.addAll(Arrays.asList(optionsArray));
+ }
- CommandLineParser commandLineParser = new BasicParser() {
- @Override
- protected void processOption(final String arg, @SuppressWarnings("rawtypes") final ListIterator iter)
- throws ParseException {
- boolean hasOption = getOptions().hasOption(arg);
- if (hasOption) {
- super.processOption(arg, iter);
- }
- }
- };
- CommandLine commandLine = commandLineParser.parse(options, argumentList.toArray(new String[] {}));
- return commandLine;
- } catch (ParseException e) {
- LoggingOutputStream loggingOutputStream = new LoggingOutputStream(log, LoggingLevelEnum.INFO);
- PrintWriter printWriter = new PrintWriter(loggingOutputStream);
+ CommandLineParser commandLineParser = new BasicParser() {
+ @Override
+ protected void processOption(final String arg,
+ @SuppressWarnings("rawtypes") final ListIterator iter)
+ throws ParseException {
+ boolean hasOption = getOptions().hasOption(arg);
+ if (hasOption) {
+ super.processOption(arg, iter);
+ }
+ }
+ };
+ CommandLine commandLine =
+ commandLineParser.parse(OPTIONS, argumentList.toArray(new String[] {}));
+ return commandLine;
+ } catch (ParseException e) {
+ LoggingOutputStream loggingOutputStream =
+ new LoggingOutputStream(LOGGER, LoggingLevelEnum.INFO);
+ PrintWriter printWriter =
+ new PrintWriter(loggingOutputStream, true, Charset.defaultCharset());
- HelpFormatter helpFormatter = new HelpFormatter();
- helpFormatter.printHelp(printWriter, 74, "javadoc -doclet " + XmlDoclet.class.getName() + " [options]",
- null, options, 1, 3, null, false);
- return null;
- }
- }
+ HelpFormatter helpFormatter = new HelpFormatter();
+ helpFormatter.printHelp(printWriter, 74,
+ "javadoc -doclet " + XmlDoclet.class.getName() + " [options]",
+ null, OPTIONS, 1, 3, null, false);
+ return null;
+ }
+ }
}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/AbstractTestParent.java b/src/test/java/com/github/markusbernhardt/xmldoclet/AbstractTestParent.java
index 4a0b392..8c9783f 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/AbstractTestParent.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/AbstractTestParent.java
@@ -18,156 +18,140 @@
*/
public class AbstractTestParent {
- private final static Logger log = LoggerFactory.getLogger(AbstractTestParent.class);
-
- /**
- * Processes the source code using javadoc.
- *
- * @param extendedClassPath
- * Any classpath information required to help along javadoc.
- * Javadoc will actualy compile the source code you specify; so
- * if there are any jars or classes that are referenced by the
- * source code to process, then including those compiled items in
- * the classpath will give you more complete data in the
- * resulting XML.
- * @param sourcePaths
- * Usually sourcePaths is specified in conjuction with
- * either/both packages & subpackages. The sourcepaths value
- * should be the path of the source files right before the
- * standard package-based folder layout of projects begins. For
- * example, if you have code that exists in package foo.bar, and
- * your code is physically in /MyFolder/foo/bar/ , then the
- * sourcePaths would be /MyFolder
- * @param packages
- * Use if you want to detail specific packages to process
- * (contrast with subpackages, which is probably the easiest/most
- * brute force way of using xml-doclet). If you have within your
- * code two packages, foo.bar and bar.foo, but only wanted
- * foo.bar processed, then specify just 'foo.bar' for this
- * argument.
- * @param sourceFiles
- * You can specify source files individually. This usually is
- * used instead of sourcePaths/subPackages/packages. If you use
- * this parameter, specify the full path of any java file you
- * want processed.
- * @param subPackages
- * You can specify 'subPackages', which simply gives one an easy
- * way to specify the root package, and have javadoc recursively
- * look through everything under that package. So for instance,
- * if you had foo.bar, foo.bar.bar, and bar.foo, specifying 'foo'
- * will process foo.bar and foo.bar.bar packages, but not bar.foo
- * (unless you specify 'bar' as a subpackage, too)
- * @param additionalArguments
- * Additional Arguments.
- * @return XStream compatible data structure
- */
- public Root executeJavadoc(String extendedClassPath, String[] sourcePaths, String[] packages, String[] sourceFiles,
- String[] subPackages, String[] additionalArguments) {
- try {
- OutputStream errors = new LoggingOutputStream(log, LoggingLevelEnum.ERROR);
- OutputStream warnings = new LoggingOutputStream(log, LoggingLevelEnum.WARN);
- OutputStream notices = new LoggingOutputStream(log, LoggingLevelEnum.INFO);
-
- PrintWriter errorWriter = new PrintWriter(errors, false);
- PrintWriter warningWriter = new PrintWriter(warnings, false);
- PrintWriter noticeWriter = new PrintWriter(notices, false);
-
- // aggregate arguments and packages
- ArrayList argumentList = new ArrayList();
-
- // by setting this to 'private', nothing is omitted in the parsing
- argumentList.add("-private");
-
- String classPath = System.getProperty("java.class.path", ".");
- if (extendedClassPath != null) {
- classPath += File.pathSeparator + extendedClassPath;
- }
- argumentList.add("-classpath");
- argumentList.add(classPath);
-
- if (sourcePaths != null) {
- String concatedSourcePaths = join(File.pathSeparator, sourcePaths);
- if (concatedSourcePaths.length() > 0) {
- argumentList.add("-sourcepath");
- argumentList.add(concatedSourcePaths);
- }
- }
-
- if (subPackages != null) {
- String concatedSubPackages = join(";", subPackages);
- if (concatedSubPackages.length() > 0) {
- argumentList.add("-subpackages");
- argumentList.add(concatedSubPackages);
- }
- }
-
- if (packages != null) {
- argumentList.addAll(Arrays.asList(packages));
- }
-
- if (sourceFiles != null) {
- argumentList.addAll(Arrays.asList(sourceFiles));
- }
-
- if (additionalArguments != null) {
- argumentList.addAll(Arrays.asList(additionalArguments));
- }
-
- log.info("Executing doclet with arguments: " + join(" ", argumentList));
-
- String[] arguments = argumentList.toArray(new String[] {});
- com.sun.tools.javadoc.Main.execute("xml-doclet", errorWriter, warningWriter, noticeWriter,
- XmlDoclet.class.getName(), arguments);
-
- errors.close();
- warnings.close();
- notices.close();
-
- log.info("done with doclet processing");
- } catch (Exception e) {
- log.error("doclet exception", e);
- } catch (Error e) {
- log.error("doclet error", e);
- }
-
- return XmlDoclet.root;
- }
-
- /**
- * Helper method to concat strings.
- *
- * @param glue
- * the seperator.
- * @param strings
- * the strings to concat.
- * @return concated string
- */
- public static String join(String glue, String[] strings) {
- return join(glue, Arrays.asList(strings));
- }
-
- /**
- * Helper method to concat strings.
- *
- * @param glue
- * the seperator.
- * @param strings
- * the strings to concat.
- * @return concated string
- */
- public static String join(String glue, Iterable strings) {
- if (strings == null) {
- return null;
- }
-
- StringBuilder stringBuilder = new StringBuilder();
- String verkett = "";
- for (String string : strings) {
- stringBuilder.append(verkett);
- stringBuilder.append(string);
- verkett = glue;
- }
- return stringBuilder.toString();
- }
+ private final static Logger LOGGER = LoggerFactory.getLogger(AbstractTestParent.class);
+
+ /**
+ * Processes the source code using javadoc.
+ *
+ * @param extendedClassPath Any classpath information required to help along javadoc. Javadoc
+ * will actualy compile the source code you specify; so if there are any jars or classes
+ * that are referenced by the source code to process, then including those compiled items
+ * in the classpath will give you more complete data in the resulting XML.
+ * @param sourcePaths Usually sourcePaths is specified in conjuction with either/both packages &
+ * subpackages. The sourcepaths value should be the path of the source files right before
+ * the standard package-based folder layout of projects begins. For example, if you have
+ * code that exists in package foo.bar, and your code is physically in /MyFolder/foo/bar/
+ * , then the sourcePaths would be /MyFolder
+ * @param packages Use if you want to detail specific packages to process (contrast with
+ * subpackages, which is probably the easiest/most brute force way of using xml-doclet).
+ * If you have within your code two packages, foo.bar and bar.foo, but only wanted
+ * foo.bar processed, then specify just 'foo.bar' for this argument.
+ * @param sourceFiles You can specify source files individually. This usually is used instead of
+ * sourcePaths/subPackages/packages. If you use this parameter, specify the full path of
+ * any java file you want processed.
+ * @param subPackages You can specify 'subPackages', which simply gives one an easy way to
+ * specify the root package, and have javadoc recursively look through everything under
+ * that package. So for instance, if you had foo.bar, foo.bar.bar, and bar.foo,
+ * specifying 'foo' will process foo.bar and foo.bar.bar packages, but not bar.foo
+ * (unless you specify 'bar' as a subpackage, too)
+ * @param additionalArguments Additional Arguments.
+ * @return XStream compatible data structure
+ */
+ public Root executeJavadoc(String extendedClassPath, String[] sourcePaths, String[] packages,
+ String[] sourceFiles,
+ String[] subPackages, String[] additionalArguments) {
+ try {
+ OutputStream errors = new LoggingOutputStream(LOGGER, LoggingLevelEnum.ERROR);
+ OutputStream warnings = new LoggingOutputStream(LOGGER, LoggingLevelEnum.WARN);
+ OutputStream notices = new LoggingOutputStream(LOGGER, LoggingLevelEnum.INFO);
+
+ PrintWriter errorWriter = new PrintWriter(errors, false);
+ PrintWriter warningWriter = new PrintWriter(warnings, false);
+ PrintWriter noticeWriter = new PrintWriter(notices, false);
+
+ // aggregate arguments and packages
+ ArrayList argumentList = new ArrayList();
+
+ // by setting this to 'private', nothing is omitted in the parsing
+ argumentList.add("-private");
+
+ String classPath = System.getProperty("java.class.path", ".");
+ if (extendedClassPath != null) {
+ classPath += File.pathSeparator + extendedClassPath;
+ }
+ argumentList.add("-classpath");
+ argumentList.add(classPath);
+
+ if (sourcePaths != null) {
+ String concatedSourcePaths = join(File.pathSeparator, sourcePaths);
+ if (concatedSourcePaths.length() > 0) {
+ argumentList.add("-sourcepath");
+ argumentList.add(concatedSourcePaths);
+ }
+ }
+
+ if (subPackages != null) {
+ String concatedSubPackages = join(";", subPackages);
+ if (concatedSubPackages.length() > 0) {
+ argumentList.add("-subpackages");
+ argumentList.add(concatedSubPackages);
+ }
+ }
+
+ if (packages != null) {
+ argumentList.addAll(Arrays.asList(packages));
+ }
+
+ if (sourceFiles != null) {
+ argumentList.addAll(Arrays.asList(sourceFiles));
+ }
+
+ if (additionalArguments != null) {
+ argumentList.addAll(Arrays.asList(additionalArguments));
+ }
+
+ LOGGER.info("Executing doclet with arguments: " + join(" ", argumentList));
+
+ String[] arguments = argumentList.toArray(new String[] {});
+ com.sun.tools.javadoc.Main.execute("xml-doclet", errorWriter, warningWriter,
+ noticeWriter,
+ XmlDoclet.class.getName(), arguments);
+
+ errors.close();
+ warnings.close();
+ notices.close();
+
+ LOGGER.info("done with doclet processing");
+ } catch (Exception e) {
+ LOGGER.error("doclet exception", e);
+ } catch (Error e) {
+ LOGGER.error("doclet error", e);
+ }
+
+ return XmlDoclet.root;
+ }
+
+ /**
+ * Helper method to concat strings.
+ *
+ * @param glue the seperator.
+ * @param strings the strings to concat.
+ * @return concated string
+ */
+ public static String join(String glue, String[] strings) {
+ return join(glue, Arrays.asList(strings));
+ }
+
+ /**
+ * Helper method to concat strings.
+ *
+ * @param glue the seperator.
+ * @param strings the strings to concat.
+ * @return concated string
+ */
+ public static String join(String glue, Iterable strings) {
+ if (strings == null) {
+ return null;
+ }
+
+ StringBuilder stringBuilder = new StringBuilder();
+ String verkett = "";
+ for (String string : strings) {
+ stringBuilder.append(verkett);
+ stringBuilder.append(string);
+ verkett = glue;
+ }
+ return stringBuilder.toString();
+ }
}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/AnnotationTest.java b/src/test/java/com/github/markusbernhardt/xmldoclet/AnnotationTest.java
index e86e414..11474c0 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/AnnotationTest.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/AnnotationTest.java
@@ -19,137 +19,147 @@
*/
@SuppressWarnings("deprecation")
public class AnnotationTest extends AbstractTestParent {
- /**
- * Rigourous Parser :-)
- */
- @Test
- public void testSampledoc() {
- executeJavadoc(null, new String[] { "./src/test/java" }, null, null, new String[] { "com" },
- new String[] { "-dryrun" });
- }
-
- /**
- * testing an annotation with nothing defined
- */
- @Test
- public void testAnnotation1() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation1.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Annotation annotationNode = packageNode.getAnnotation().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertEquals(packageNode.getComment(), null);
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 1);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(annotationNode.getComment(), "Annotation1");
- assertEquals(annotationNode.getName(), Annotation1.class.getSimpleName());
- assertEquals(annotationNode.getQualified(), Annotation1.class.getName());
- assertEquals(annotationNode.getScope(), "public");
- assertEquals(annotationNode.getAnnotation().size(), 0);
- assertEquals(annotationNode.getElement().size(), 0);
- assertTrue(annotationNode.isIncluded());
- }
-
- /**
- * testing an annotation with an annotation decorating it
- */
- @Test
- public void testAnnotation2() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation2.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Annotation annotationNode = packageNode.getAnnotation().get(0);
- AnnotationInstance annotationInstance = annotationNode.getAnnotation().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertEquals(packageNode.getComment(), null);
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 1);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(annotationNode.getComment(), "Annotation2");
- assertEquals(annotationNode.getName(), Annotation2.class.getSimpleName());
- assertEquals(annotationNode.getQualified(), Annotation2.class.getName());
- assertEquals(annotationNode.getScope(), "public");
- assertEquals(annotationNode.getAnnotation().size(), 1);
- assertEquals(annotationNode.getElement().size(), 0);
- assertTrue(annotationNode.isIncluded());
-
- // test annotation 'deprecated' on class
- assertEquals(annotationInstance.getQualified(), "java.lang.Deprecated");
- assertEquals(annotationInstance.getName(), "Deprecated");
- assertEquals(annotationInstance.getArgument().size(), 0);
- }
-
- /**
- * testing an annotation with one element field
- */
- @Test
- public void testAnnotation3() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation3.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Annotation annotationNode = packageNode.getAnnotation().get(0);
- AnnotationElement element = annotationNode.getElement().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertEquals(packageNode.getComment(), null);
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 1);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(annotationNode.getComment(), "Annotation3");
- assertEquals(annotationNode.getName(), Annotation3.class.getSimpleName());
- assertEquals(annotationNode.getQualified(), Annotation3.class.getName());
- assertEquals(annotationNode.getScope(), "public");
- assertEquals(annotationNode.getAnnotation().size(), 0);
- assertEquals(annotationNode.getElement().size(), 1);
- assertTrue(annotationNode.isIncluded());
-
- // test annotation element
- assertEquals(element.getName(), "id");
- assertEquals(element.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Annotation3.id");
- assertEquals(element.getType().getQualified(), "int");
- assertEquals(element.getDefault(), Integer.toString(3));
- }
-
- /**
- * testing an annotation with non-public definition
- */
- @Test
- public void testAnnotation4() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation4.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Annotation annotationNode = packageNode.getAnnotation().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertEquals(packageNode.getComment(), null);
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 1);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(annotationNode.getComment(), "Annotation4");
- assertEquals(annotationNode.getName(), "Annotation4");
- assertEquals(annotationNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Annotation4");
- assertEquals(annotationNode.getScope(), "");
- assertEquals(annotationNode.getAnnotation().size(), 0);
- assertEquals(annotationNode.getElement().size(), 0);
- assertTrue(annotationNode.isIncluded());
- }
-}
\ No newline at end of file
+ /**
+ * Rigourous Parser :-)
+ */
+ @Test
+ public void testSampledoc() {
+ executeJavadoc(null, new String[] {"./src/test/java"}, null, null, new String[] {"com"},
+ new String[] {"-dryrun"});
+ }
+
+ /**
+ * testing an annotation with nothing defined
+ */
+ @Test
+ public void testAnnotation1() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation1.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Annotation annotationNode = packageNode.getAnnotation().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertEquals(packageNode.getComment(), null);
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 1);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(annotationNode.getComment(), "Annotation1");
+ assertEquals(annotationNode.getName(), Annotation1.class.getSimpleName());
+ assertEquals(annotationNode.getQualified(), Annotation1.class.getName());
+ assertEquals(annotationNode.getScope(), "public");
+ assertEquals(annotationNode.getAnnotation().size(), 0);
+ assertEquals(annotationNode.getElement().size(), 0);
+ assertTrue(annotationNode.isIncluded());
+ }
+
+ /**
+ * testing an annotation with an annotation decorating it
+ */
+ @Test
+ public void testAnnotation2() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation2.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Annotation annotationNode = packageNode.getAnnotation().get(0);
+ AnnotationInstance annotationInstance = annotationNode.getAnnotation().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertEquals(packageNode.getComment(), null);
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 1);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(annotationNode.getComment(), "Annotation2");
+ assertEquals(annotationNode.getName(), Annotation2.class.getSimpleName());
+ assertEquals(annotationNode.getQualified(), Annotation2.class.getName());
+ assertEquals(annotationNode.getScope(), "public");
+ assertEquals(annotationNode.getAnnotation().size(), 1);
+ assertEquals(annotationNode.getElement().size(), 0);
+ assertTrue(annotationNode.isIncluded());
+
+ // test annotation 'deprecated' on class
+ assertEquals(annotationInstance.getQualified(), "java.lang.Deprecated");
+ assertEquals(annotationInstance.getName(), "Deprecated");
+ assertEquals(annotationInstance.getArgument().size(), 0);
+ }
+
+ /**
+ * testing an annotation with one element field
+ */
+ @Test
+ public void testAnnotation3() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation3.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Annotation annotationNode = packageNode.getAnnotation().get(0);
+ AnnotationElement element = annotationNode.getElement().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertEquals(packageNode.getComment(), null);
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 1);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(annotationNode.getComment(), "Annotation3");
+ assertEquals(annotationNode.getName(), Annotation3.class.getSimpleName());
+ assertEquals(annotationNode.getQualified(), Annotation3.class.getName());
+ assertEquals(annotationNode.getScope(), "public");
+ assertEquals(annotationNode.getAnnotation().size(), 0);
+ assertEquals(annotationNode.getElement().size(), 1);
+ assertTrue(annotationNode.isIncluded());
+
+ // test annotation element
+ assertEquals(element.getName(), "id");
+ assertEquals(element.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Annotation3.id");
+ assertEquals(element.getType().getQualified(), "int");
+ assertEquals(element.getDefault(), Integer.toString(3));
+ }
+
+ /**
+ * testing an annotation with non-public definition
+ */
+ @Test
+ public void testAnnotation4() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation4.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Annotation annotationNode = packageNode.getAnnotation().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertEquals(packageNode.getComment(), null);
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 1);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(annotationNode.getComment(), "Annotation4");
+ assertEquals(annotationNode.getName(), "Annotation4");
+ assertEquals(annotationNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Annotation4");
+ assertEquals(annotationNode.getScope(), "");
+ assertEquals(annotationNode.getAnnotation().size(), 0);
+ assertEquals(annotationNode.getElement().size(), 0);
+ assertTrue(annotationNode.isIncluded());
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/ClassTest.java b/src/test/java/com/github/markusbernhardt/xmldoclet/ClassTest.java
index dbd3731..e5b4e4a 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/ClassTest.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/ClassTest.java
@@ -1,961 +1,1013 @@
-package com.github.markusbernhardt.xmldoclet;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.github.markusbernhardt.xmldoclet.simpledata.Annotation3;
-import com.github.markusbernhardt.xmldoclet.simpledata.AnnotationCascadeChild;
-import com.github.markusbernhardt.xmldoclet.simpledata.Class1;
-import com.github.markusbernhardt.xmldoclet.simpledata.Class2;
-import com.github.markusbernhardt.xmldoclet.simpledata.Class3;
-import com.github.markusbernhardt.xmldoclet.simpledata.Class4;
-import com.github.markusbernhardt.xmldoclet.simpledata.Class5;
-import com.github.markusbernhardt.xmldoclet.simpledata.Class6;
-import com.github.markusbernhardt.xmldoclet.simpledata.Class7;
-import com.github.markusbernhardt.xmldoclet.simpledata.Class8;
-import com.github.markusbernhardt.xmldoclet.simpledata.Class9;
-import com.github.markusbernhardt.xmldoclet.simpledata.ClassAnnotationCascade;
-import com.github.markusbernhardt.xmldoclet.xjc.AnnotationArgument;
-import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
-import com.github.markusbernhardt.xmldoclet.xjc.Class;
-import com.github.markusbernhardt.xmldoclet.xjc.Constructor;
-import com.github.markusbernhardt.xmldoclet.xjc.Field;
-import com.github.markusbernhardt.xmldoclet.xjc.Method;
-import com.github.markusbernhardt.xmldoclet.xjc.Package;
-import com.github.markusbernhardt.xmldoclet.xjc.Root;
-import com.github.markusbernhardt.xmldoclet.xjc.TypeInfo;
-import com.github.markusbernhardt.xmldoclet.xjc.TypeParameter;
-
-/**
- * Unit test group for Classes
- */
-@SuppressWarnings("deprecation")
-public class ClassTest extends AbstractTestParent {
-
- /**
- * Testing nested Annotations
- * @see ClassAnnotationCascade
- */
- @Test
- public void testClassAnnotationCascade() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/ClassAnnotationCascade.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertEquals(packageNode.getComment(), null);
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getClazz().size(), 1);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
-
- assertEquals("ClassAnnotationCascade", classNode.getComment());
- assertEquals("ClassAnnotationCascade", classNode.getName());
-
- assertEquals(ClassAnnotationCascade.class.getName(), classNode.getQualified());
-
- assertEquals(classNode.getAnnotation().size(), 1);
- AnnotationInstance annotationNode = classNode.getAnnotation().get(0);
-
- assertEquals("AnnotationCascade", annotationNode.getName() );
- assertEquals(1, annotationNode.getArgument().size());
-
- AnnotationArgument annotationArgNode = annotationNode.getArgument().get(0);
-
- // Two nested annotations in child attribute
- assertEquals("children", annotationArgNode.getName());
- assertEquals(0, annotationArgNode.getValue().size());
- assertEquals(2, annotationArgNode.getAnnotation().size());
-
- AnnotationInstance annonNodePrimitive = annotationArgNode.getAnnotation().get(0);
- AnnotationInstance annonNodeNested = annotationArgNode.getAnnotation().get(1);
-
- // Equal attribs
- assertEquals(AnnotationCascadeChild.class.getSimpleName(), annonNodePrimitive.getName());
- assertEquals(AnnotationCascadeChild.class.getSimpleName(), annonNodeNested.getName());
- assertEquals(AnnotationCascadeChild.class.getName(), annonNodePrimitive.getQualified());
- assertEquals(AnnotationCascadeChild.class.getName(), annonNodeNested.getQualified());
- assertEquals(2, annonNodePrimitive.getArgument().size());
- assertEquals(2, annonNodeNested.getArgument().size());
- assertEquals("name", annonNodePrimitive.getArgument().get(0).getName());
- assertEquals("name", annonNodeNested.getArgument().get(0).getName());
-
- // Primitive
- AnnotationArgument annArgNodePrimitive = annonNodePrimitive.getArgument().get(1);
- assertEquals("dummyData", annArgNodePrimitive.getName());
- assertEquals("java.lang.String", annArgNodePrimitive.getType().getQualified());
- assertEquals(0, annArgNodePrimitive.getAnnotation().size());
- assertEquals(3, annArgNodePrimitive.getValue().size());
- assertEquals("A", annArgNodePrimitive.getValue().get(0));
- assertEquals("B", annArgNodePrimitive.getValue().get(1));
- assertEquals("C", annArgNodePrimitive.getValue().get(2));
-
- // Nested
- AnnotationArgument annArgNodeNested = annonNodeNested.getArgument().get(1);
- assertEquals("subAnnotations", annArgNodeNested.getName());
- assertEquals(Annotation3.class.getName(), annArgNodeNested.getType().getQualified());
- assertEquals(3, annArgNodeNested.getAnnotation().size());
- assertEquals(0, annArgNodeNested.getValue().size());
- assertEquals(Annotation3.class.getSimpleName(), annArgNodeNested.getAnnotation().get(0).getName());
- assertEquals(Annotation3.class.getName(), annArgNodeNested.getAnnotation().get(1).getQualified());
- assertEquals(1, annArgNodeNested.getAnnotation().get(2).getArgument().size());
-
- assertEquals("666", annArgNodeNested.getAnnotation().get(2).getArgument().get(0).getValue().get(0));
- }
-
-
- /**
- * Rigourous Parser :-)
- */
- @Test
- public void testSampledoc() {
- executeJavadoc(".", new String[] { "./src/test/java" }, null, null, new String[] { "com" },
- new String[] { "-dryrun" });
- }
-
- /**
- * testing a class with nothing defined EMPIRICAL OBSERVATION: The default
- * constructor created by the java compiler is not marked synthetic. um
- * what?
- */
- @Test
- public void testClass1() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class1.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class1");
- assertEquals(classNode.getName(), Class1.class.getSimpleName());
- assertEquals(classNode.getQualified(), Class1.class.getName());
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
- }
-
- /**
- * testing a class with 1 constructor
- */
- @Test
- public void testClass2() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class2.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- Constructor constructor = classNode.getConstructor().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class2");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), Class2.class.getSimpleName());
- assertEquals(classNode.getQualified(), Class2.class.getName());
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
-
- assertEquals(constructor.getComment(), "Constructor1");
- assertEquals(constructor.getName(), "Class2");
- assertEquals(constructor.getParameter().size(), 0);
- assertEquals(constructor.getAnnotation().size(), 0);
- }
-
- /**
- * testing a class with 1 method
- */
- @Test
- public void testClass3() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class3.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- Method method = classNode.getMethod().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class3");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), Class3.class.getSimpleName());
- assertEquals(classNode.getQualified(), Class3.class.getName());
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getMethod().size(), 1);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
-
- assertEquals(method.getComment(), "method1");
- assertEquals(method.getName(), "method1");
- assertEquals(method.getSignature(), "()");
- assertFalse(method.isFinal());
- assertFalse(method.isNative());
- assertFalse(method.isStatic());
- assertFalse(method.isSynchronized());
- assertFalse(method.isVarArgs());
- assertEquals(method.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Class3.method1");
- assertEquals(method.getScope(), "public");
- assertEquals(method.getAnnotation().size(), 0);
- assertEquals(method.getParameter().size(), 0);
- assertEquals(method.getException().size(), 0);
-
- TypeInfo returnNode = method.getReturn();
- assertEquals(returnNode.getQualified(), "int");
- assertNull(returnNode.getDimension());
- assertEquals(returnNode.getGeneric().size(), 0);
- assertNull(returnNode.getWildcard());
- }
-
- /**
- * testing a class with 1 field
- */
- @Test
- public void testClass4() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class4.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- Field field = classNode.getField().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class4");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), Class4.class.getSimpleName());
- assertEquals(classNode.getQualified(), Class4.class.getName());
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getField().size(), 1);
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
-
- // test field
- assertEquals(field.getComment(), "field1");
- assertEquals(field.getName(), "field1");
- assertEquals(field.getScope(), "public");
- assertEquals(field.getType().getQualified(), "int");
- assertNull(field.getType().getDimension());
- assertEquals(field.getType().getGeneric().size(), 0);
- assertNull(field.getType().getWildcard());
- assertFalse(field.isStatic());
- assertFalse(field.isTransient());
- assertFalse(field.isVolatile());
- assertFalse(field.isFinal());
- assertNull(field.getConstant());
- assertEquals(field.getAnnotation().size(), 0);
- }
-
- /**
- * testing a class that extends another class with 1 method
- */
- @Test
- public void testClass5() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class5.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class3.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 2);
-
- assertEquals(classNode.getComment(), "Class5");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), Class5.class.getSimpleName());
- assertEquals(classNode.getQualified(), Class5.class.getName());
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Class3");
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
- }
-
- /**
- * testing a class that implements one interface
- */
- @Test
- public void testClass6() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class6.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- TypeInfo interfaceNode = classNode.getInterface().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class6");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), Class6.class.getSimpleName());
- assertEquals(classNode.getQualified(), Class6.class.getName());
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 1);
- assertEquals(classNode.getInterface().size(), 1);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
-
- // the particular interface chosen for this test also will change this
- // flag to true!
- assertTrue(classNode.isSerializable());
-
- // verify interface
- assertEquals(interfaceNode.getQualified(), java.io.Serializable.class.getName());
- }
-
- /**
- * testing one annotation instance on the class
- */
- @Test
- public void testClass7() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class7.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance annotationNode = classNode.getAnnotation().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class7");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), Class7.class.getSimpleName());
- assertEquals(classNode.getQualified(), Class7.class.getName());
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 1);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
-
- // test annotation 'deprecated' on class
- assertEquals(annotationNode.getQualified(), "java.lang.Deprecated");
- assertEquals(annotationNode.getName(), "Deprecated");
- assertEquals(annotationNode.getArgument().size(), 0);
- }
-
- /**
- * testing abstract keyword on class
- */
- @Test
- public void testClass8() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class8.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class8");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), Class8.class.getSimpleName());
- assertEquals(classNode.getQualified(), Class8.class.getName());
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertTrue(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
- }
-
- /**
- * testing java.io.Externalizable interface on class
- */
- @Test
- public void testClass9() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class9.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class9");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), Class9.class.getSimpleName());
- assertEquals(classNode.getQualified(), Class9.class.getName());
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getMethod().size(), 2);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 1);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertTrue(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertTrue(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
- }
-
- /**
- * testing difference of scope modifier on class
- */
- @Test
- public void testClass10() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class10.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class10");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), "Class10");
- assertEquals(classNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Class10");
- assertEquals(classNode.getScope(), "");
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
- }
-
- /**
- * testing if isException is populated correctly
- */
- @Test
- public void testClass11() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class11.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class11");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), "Class11");
- assertEquals(classNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Class11");
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 1);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), java.lang.Exception.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertTrue(classNode.isSerializable());
- assertTrue(classNode.isException());
- assertFalse(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
- }
-
- /**
- * testing if isError is populated correctly
- */
- @Test
- public void testClass12() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class12.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class12");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), "Class12");
- assertEquals(classNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Class12");
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 1);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), java.lang.Error.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertTrue(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertTrue(classNode.isError());
- assertEquals(classNode.getGeneric().size(), 0);
- }
-
- /**
- * testing if type variables can be determined
- */
- @Test
- public void testClass13() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class13.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- TypeParameter typeParameter = classNode.getGeneric().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class13");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), "Class13");
- assertEquals(classNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Class13");
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getGeneric().size(), 1);
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
-
- // check the 'fun' type var
- assertEquals(typeParameter.getName(), "Fun");
- assertEquals(typeParameter.getBound().size(), 0);
- }
-
- /**
- * testing if a single bounds can be determined
- */
- @Test
- public void testClass14() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class14.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- TypeParameter typeParameter = classNode.getGeneric().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class14");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), "Class14");
- assertEquals(classNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Class14");
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getGeneric().size(), 1);
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
-
- // check the 'fun' type var
-
- assertEquals(typeParameter.getName(), "Fun");
- assertEquals(typeParameter.getBound().size(), 1);
- assertEquals(typeParameter.getBound().get(0), Number.class.getName());
- }
-
- /**
- * testing if a multiple bounds can be determined
- */
- @Test
- public void testClass15() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class15.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- TypeParameter typeParameter = classNode.getGeneric().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getComment(), "Class15");
- assertEquals(classNode.getConstructor().size(), 1);
- assertEquals(classNode.getName(), "Class15");
- assertEquals(classNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Class15");
- assertEquals(classNode.getScope(), "public");
- assertEquals(classNode.getGeneric().size(), 1);
- assertEquals(classNode.getMethod().size(), 0);
- assertEquals(classNode.getField().size(), 0);
- assertEquals(classNode.getAnnotation().size(), 0);
- assertEquals(classNode.getInterface().size(), 0);
- assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
- assertFalse(classNode.isAbstract());
- assertFalse(classNode.isExternalizable());
- assertTrue(classNode.isIncluded());
- assertFalse(classNode.isSerializable());
- assertFalse(classNode.isException());
- assertFalse(classNode.isError());
-
- // check the 'fun' type var
- assertEquals(typeParameter.getName(), "Fun");
- assertEquals(typeParameter.getBound().size(), 2);
- assertEquals(typeParameter.getBound().get(0), Number.class.getName());
- assertEquals(typeParameter.getBound().get(1), Runnable.class.getName());
- }
-
- /**
- * testing integer annotation argument
- */
- @Test
- public void testClass16() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class16.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation3.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance instance = classNode.getAnnotation().get(0);
- AnnotationArgument argument = instance.getArgument().get(0);
- assertEquals(argument.getName(), "id");
- assertEquals(argument.getType().getQualified(), "int");
- assertEquals(argument.getValue().size(), 1);
- assertEquals(argument.getValue().get(0), "3");
- assertTrue(argument.isPrimitive());
- assertFalse(argument.isArray());
- }
-
- /**
- * testing integer array annotation argument
- */
- @Test
- public void testClass17() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class17.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation5.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance instance = classNode.getAnnotation().get(0);
- AnnotationArgument argument = instance.getArgument().get(0);
- assertEquals(argument.getType().getQualified(), "int");
- assertEquals(argument.getValue().size(), 2);
- assertEquals(argument.getValue().get(0), "1");
- assertEquals(argument.getValue().get(1), "2");
- assertTrue(argument.isPrimitive());
- assertTrue(argument.isArray());
- }
-
- /**
- * testing integer array annotation argument
- */
- @Test
- public void testClass18() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class18.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation6.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance instance = classNode.getAnnotation().get(0);
- AnnotationArgument argument = instance.getArgument().get(0);
- assertEquals(argument.getType().getQualified(), "java.lang.String");
- assertEquals(argument.getValue().size(), 1);
- assertEquals(argument.getValue().get(0), "hey");
- assertFalse(argument.isPrimitive());
- assertFalse(argument.isArray());
- }
-
- /**
- * testing enum annotation argument
- */
- @Test
- public void testClass19() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class19.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation7.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum1.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance instance = classNode.getAnnotation().get(0);
- AnnotationArgument argument = instance.getArgument().get(0);
- assertEquals(argument.getType().getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Enum1");
- assertEquals(argument.getValue().size(), 1);
- assertEquals(argument.getValue().get(0), "a");
- assertFalse(argument.isPrimitive());
- assertFalse(argument.isArray());
- }
-
- /**
- * testing class annotation argument
- */
- @Test
- public void testClass20() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class20.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation8.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance instance = classNode.getAnnotation().get(0);
- AnnotationArgument argument = instance.getArgument().get(0);
- assertEquals(argument.getType().getQualified(), "java.lang.Class");
- assertEquals(argument.getValue().size(), 1);
- assertEquals(argument.getValue().get(0), "java.lang.String");
- assertFalse(argument.isPrimitive());
- assertFalse(argument.isArray());
- }
-
- /**
- * testing character annotation argument
- */
- @Test
- public void testClass21() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class21.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation10.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance instance = classNode.getAnnotation().get(0);
- AnnotationArgument argument = instance.getArgument().get(0);
- assertEquals(argument.getType().getQualified(), "char");
- assertEquals(argument.getValue().size(), 1);
- assertEquals(argument.getValue().get(0), Integer.toString((int) 'a'));
- assertTrue(argument.isPrimitive());
- assertFalse(argument.isArray());
- }
-
- /**
- * testing 0 character annotation argument
- */
- @Test
- public void testClass22() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class22.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation10.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance instance = classNode.getAnnotation().get(0);
- AnnotationArgument argument = instance.getArgument().get(0);
- assertEquals(argument.getType().getQualified(), "char");
- assertEquals(argument.getValue().size(), 1);
- assertEquals(argument.getValue().get(0), Integer.toString(0));
- assertTrue(argument.isPrimitive());
- assertFalse(argument.isArray());
- }
-
- /**
- * testing boolean annotation argument
- */
- @Test
- public void testClass23() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class23.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation11.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance instance = classNode.getAnnotation().get(0);
- AnnotationArgument argument = instance.getArgument().get(0);
- assertEquals(argument.getType().getQualified(), "boolean");
- assertEquals(argument.getValue().size(), 1);
- assertEquals(argument.getValue().get(0), Boolean.TRUE.toString());
- assertTrue(argument.isPrimitive());
- assertFalse(argument.isArray());
- }
-
- /**
- * testing empty int array annotation argument
- */
- @Test
- public void testClass24() {
- String[] sourceFiles = new String[] {
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class24.java",
- "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation5.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- AnnotationInstance instance = classNode.getAnnotation().get(0);
- AnnotationArgument argument = instance.getArgument().get(0);
- assertEquals(argument.getType().getQualified(), "int");
- assertEquals(argument.getValue().size(), 0);
- assertTrue(argument.isPrimitive());
- assertTrue(argument.isArray());
- }
-}
+package com.github.markusbernhardt.xmldoclet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.github.markusbernhardt.xmldoclet.simpledata.Annotation3;
+import com.github.markusbernhardt.xmldoclet.simpledata.AnnotationCascadeChild;
+import com.github.markusbernhardt.xmldoclet.simpledata.Class1;
+import com.github.markusbernhardt.xmldoclet.simpledata.Class2;
+import com.github.markusbernhardt.xmldoclet.simpledata.Class3;
+import com.github.markusbernhardt.xmldoclet.simpledata.Class4;
+import com.github.markusbernhardt.xmldoclet.simpledata.Class5;
+import com.github.markusbernhardt.xmldoclet.simpledata.Class6;
+import com.github.markusbernhardt.xmldoclet.simpledata.Class7;
+import com.github.markusbernhardt.xmldoclet.simpledata.Class8;
+import com.github.markusbernhardt.xmldoclet.simpledata.Class9;
+import com.github.markusbernhardt.xmldoclet.simpledata.ClassAnnotationCascade;
+import com.github.markusbernhardt.xmldoclet.xjc.AnnotationArgument;
+import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
+import com.github.markusbernhardt.xmldoclet.xjc.Class;
+import com.github.markusbernhardt.xmldoclet.xjc.Constructor;
+import com.github.markusbernhardt.xmldoclet.xjc.Field;
+import com.github.markusbernhardt.xmldoclet.xjc.Method;
+import com.github.markusbernhardt.xmldoclet.xjc.Package;
+import com.github.markusbernhardt.xmldoclet.xjc.Root;
+import com.github.markusbernhardt.xmldoclet.xjc.TypeInfo;
+import com.github.markusbernhardt.xmldoclet.xjc.TypeParameter;
+
+/**
+ * Unit test group for Classes
+ */
+@SuppressWarnings("deprecation")
+public class ClassTest extends AbstractTestParent {
+
+ /**
+ * Testing nested Annotations
+ *
+ * @see ClassAnnotationCascade
+ */
+ @Test
+ public void testClassAnnotationCascade() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/ClassAnnotationCascade.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertEquals(packageNode.getComment(), null);
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getClazz().size(), 1);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+
+ assertEquals("ClassAnnotationCascade", classNode.getComment());
+ assertEquals("ClassAnnotationCascade", classNode.getName());
+
+ assertEquals(ClassAnnotationCascade.class.getName(), classNode.getQualified());
+
+ assertEquals(classNode.getAnnotation().size(), 1);
+ AnnotationInstance annotationNode = classNode.getAnnotation().get(0);
+
+ assertEquals("AnnotationCascade", annotationNode.getName());
+ assertEquals(1, annotationNode.getArgument().size());
+
+ AnnotationArgument annotationArgNode = annotationNode.getArgument().get(0);
+
+ // Two nested annotations in child attribute
+ assertEquals("children", annotationArgNode.getName());
+ assertEquals(0, annotationArgNode.getValue().size());
+ assertEquals(2, annotationArgNode.getAnnotation().size());
+
+ AnnotationInstance annonNodePrimitive = annotationArgNode.getAnnotation().get(0);
+ AnnotationInstance annonNodeNested = annotationArgNode.getAnnotation().get(1);
+
+ // Equal attribs
+ assertEquals(AnnotationCascadeChild.class.getSimpleName(), annonNodePrimitive.getName());
+ assertEquals(AnnotationCascadeChild.class.getSimpleName(), annonNodeNested.getName());
+ assertEquals(AnnotationCascadeChild.class.getName(), annonNodePrimitive.getQualified());
+ assertEquals(AnnotationCascadeChild.class.getName(), annonNodeNested.getQualified());
+ assertEquals(2, annonNodePrimitive.getArgument().size());
+ assertEquals(2, annonNodeNested.getArgument().size());
+ assertEquals("name", annonNodePrimitive.getArgument().get(0).getName());
+ assertEquals("name", annonNodeNested.getArgument().get(0).getName());
+
+ // Primitive
+ AnnotationArgument annArgNodePrimitive = annonNodePrimitive.getArgument().get(1);
+ assertEquals("dummyData", annArgNodePrimitive.getName());
+ assertEquals("java.lang.String", annArgNodePrimitive.getType().getQualified());
+ assertEquals(0, annArgNodePrimitive.getAnnotation().size());
+ assertEquals(3, annArgNodePrimitive.getValue().size());
+ assertEquals("A", annArgNodePrimitive.getValue().get(0));
+ assertEquals("B", annArgNodePrimitive.getValue().get(1));
+ assertEquals("C", annArgNodePrimitive.getValue().get(2));
+
+ // Nested
+ AnnotationArgument annArgNodeNested = annonNodeNested.getArgument().get(1);
+ assertEquals("subAnnotations", annArgNodeNested.getName());
+ assertEquals(Annotation3.class.getName(), annArgNodeNested.getType().getQualified());
+ assertEquals(3, annArgNodeNested.getAnnotation().size());
+ assertEquals(0, annArgNodeNested.getValue().size());
+ assertEquals(Annotation3.class.getSimpleName(),
+ annArgNodeNested.getAnnotation().get(0).getName());
+ assertEquals(Annotation3.class.getName(),
+ annArgNodeNested.getAnnotation().get(1).getQualified());
+ assertEquals(1, annArgNodeNested.getAnnotation().get(2).getArgument().size());
+
+ assertEquals("666",
+ annArgNodeNested.getAnnotation().get(2).getArgument().get(0).getValue().get(0));
+ }
+
+
+ /**
+ * Rigourous Parser :-)
+ */
+ @Test
+ public void testSampledoc() {
+ executeJavadoc(".", new String[] {"./src/test/java"}, null, null, new String[] {"com"},
+ new String[] {"-dryrun"});
+ }
+
+ /**
+ * testing a class with nothing defined EMPIRICAL OBSERVATION: The default constructor created
+ * by the java compiler is not marked synthetic. um what?
+ */
+ @Test
+ public void testClass1() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class1.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class1");
+ assertEquals(classNode.getName(), Class1.class.getSimpleName());
+ assertEquals(classNode.getQualified(), Class1.class.getName());
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+ }
+
+ /**
+ * testing a class with 1 constructor
+ */
+ @Test
+ public void testClass2() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class2.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ Constructor constructor = classNode.getConstructor().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class2");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), Class2.class.getSimpleName());
+ assertEquals(classNode.getQualified(), Class2.class.getName());
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+
+ assertEquals(constructor.getComment(), "Constructor1");
+ assertEquals(constructor.getName(), "Class2");
+ assertEquals(constructor.getParameter().size(), 0);
+ assertEquals(constructor.getAnnotation().size(), 0);
+ }
+
+ /**
+ * testing a class with 1 method
+ */
+ @Test
+ public void testClass3() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class3.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ Method method = classNode.getMethod().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class3");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), Class3.class.getSimpleName());
+ assertEquals(classNode.getQualified(), Class3.class.getName());
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getMethod().size(), 1);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+
+ assertEquals(method.getComment(), "method1");
+ assertEquals(method.getName(), "method1");
+ assertEquals(method.getSignature(), "()");
+ assertFalse(method.isFinal());
+ assertFalse(method.isNative());
+ assertFalse(method.isStatic());
+ assertFalse(method.isSynchronized());
+ assertFalse(method.isVarArgs());
+ assertEquals(method.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Class3.method1");
+ assertEquals(method.getScope(), "public");
+ assertEquals(method.getAnnotation().size(), 0);
+ assertEquals(method.getParameter().size(), 0);
+ assertEquals(method.getException().size(), 0);
+
+ TypeInfo returnNode = method.getReturn();
+ assertEquals(returnNode.getQualified(), "int");
+ assertNull(returnNode.getDimension());
+ assertEquals(returnNode.getGeneric().size(), 0);
+ assertNull(returnNode.getWildcard());
+ }
+
+ /**
+ * testing a class with 1 field
+ */
+ @Test
+ public void testClass4() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class4.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ Field field = classNode.getField().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class4");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), Class4.class.getSimpleName());
+ assertEquals(classNode.getQualified(), Class4.class.getName());
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getField().size(), 1);
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+
+ // test field
+ assertEquals(field.getComment(), "field1");
+ assertEquals(field.getName(), "field1");
+ assertEquals(field.getScope(), "public");
+ assertEquals(field.getType().getQualified(), "int");
+ assertNull(field.getType().getDimension());
+ assertEquals(field.getType().getGeneric().size(), 0);
+ assertNull(field.getType().getWildcard());
+ assertFalse(field.isStatic());
+ assertFalse(field.isTransient());
+ assertFalse(field.isVolatile());
+ assertFalse(field.isFinal());
+ assertNull(field.getConstant());
+ assertEquals(field.getAnnotation().size(), 0);
+ }
+
+ /**
+ * testing a class that extends another class with 1 method
+ */
+ @Test
+ public void testClass5() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class5.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class3.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 2);
+
+ assertEquals(classNode.getComment(), "Class5");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), Class5.class.getSimpleName());
+ assertEquals(classNode.getQualified(), Class5.class.getName());
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Class3");
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+ }
+
+ /**
+ * testing a class that implements one interface
+ */
+ @Test
+ public void testClass6() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class6.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ TypeInfo interfaceNode = classNode.getInterface().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class6");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), Class6.class.getSimpleName());
+ assertEquals(classNode.getQualified(), Class6.class.getName());
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 1);
+ assertEquals(classNode.getInterface().size(), 1);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+
+ // the particular interface chosen for this test also will change this
+ // flag to true!
+ assertTrue(classNode.isSerializable());
+
+ // verify interface
+ assertEquals(interfaceNode.getQualified(), java.io.Serializable.class.getName());
+ }
+
+ /**
+ * testing one annotation instance on the class
+ */
+ @Test
+ public void testClass7() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class7.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance annotationNode = classNode.getAnnotation().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class7");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), Class7.class.getSimpleName());
+ assertEquals(classNode.getQualified(), Class7.class.getName());
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 1);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+
+ // test annotation 'deprecated' on class
+ assertEquals(annotationNode.getQualified(), "java.lang.Deprecated");
+ assertEquals(annotationNode.getName(), "Deprecated");
+ assertEquals(annotationNode.getArgument().size(), 0);
+ }
+
+ /**
+ * testing abstract keyword on class
+ */
+ @Test
+ public void testClass8() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class8.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class8");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), Class8.class.getSimpleName());
+ assertEquals(classNode.getQualified(), Class8.class.getName());
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertTrue(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+ }
+
+ /**
+ * testing java.io.Externalizable interface on class
+ */
+ @Test
+ public void testClass9() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class9.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class9");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), Class9.class.getSimpleName());
+ assertEquals(classNode.getQualified(), Class9.class.getName());
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getMethod().size(), 2);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 1);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertTrue(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertTrue(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+ }
+
+ /**
+ * testing difference of scope modifier on class
+ */
+ @Test
+ public void testClass10() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class10.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class10");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), "Class10");
+ assertEquals(classNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Class10");
+ assertEquals(classNode.getScope(), "");
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+ }
+
+ /**
+ * testing if isException is populated correctly
+ */
+ @Test
+ public void testClass11() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class11.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class11");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), "Class11");
+ assertEquals(classNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Class11");
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 1);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), java.lang.Exception.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertTrue(classNode.isSerializable());
+ assertTrue(classNode.isException());
+ assertFalse(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+ }
+
+ /**
+ * testing if isError is populated correctly
+ */
+ @Test
+ public void testClass12() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class12.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class12");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), "Class12");
+ assertEquals(classNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Class12");
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 1);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), java.lang.Error.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertTrue(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertTrue(classNode.isError());
+ assertEquals(classNode.getGeneric().size(), 0);
+ }
+
+ /**
+ * testing if type variables can be determined
+ */
+ @Test
+ public void testClass13() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class13.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ TypeParameter typeParameter = classNode.getGeneric().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class13");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), "Class13");
+ assertEquals(classNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Class13");
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getGeneric().size(), 1);
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+
+ // check the 'fun' type var
+ assertEquals(typeParameter.getName(), "Fun");
+ assertEquals(typeParameter.getBound().size(), 0);
+ }
+
+ /**
+ * testing if a single bounds can be determined
+ */
+ @Test
+ public void testClass14() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class14.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ TypeParameter typeParameter = classNode.getGeneric().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class14");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), "Class14");
+ assertEquals(classNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Class14");
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getGeneric().size(), 1);
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+
+ // check the 'fun' type var
+
+ assertEquals(typeParameter.getName(), "Fun");
+ assertEquals(typeParameter.getBound().size(), 1);
+ assertEquals(typeParameter.getBound().get(0), Number.class.getName());
+ }
+
+ /**
+ * testing if a multiple bounds can be determined
+ */
+ @Test
+ public void testClass15() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class15.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ TypeParameter typeParameter = classNode.getGeneric().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getComment(), "Class15");
+ assertEquals(classNode.getConstructor().size(), 1);
+ assertEquals(classNode.getName(), "Class15");
+ assertEquals(classNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Class15");
+ assertEquals(classNode.getScope(), "public");
+ assertEquals(classNode.getGeneric().size(), 1);
+ assertEquals(classNode.getMethod().size(), 0);
+ assertEquals(classNode.getField().size(), 0);
+ assertEquals(classNode.getAnnotation().size(), 0);
+ assertEquals(classNode.getInterface().size(), 0);
+ assertEquals(classNode.getClazz().getQualified(), Object.class.getName());
+ assertFalse(classNode.isAbstract());
+ assertFalse(classNode.isExternalizable());
+ assertTrue(classNode.isIncluded());
+ assertFalse(classNode.isSerializable());
+ assertFalse(classNode.isException());
+ assertFalse(classNode.isError());
+
+ // check the 'fun' type var
+ assertEquals(typeParameter.getName(), "Fun");
+ assertEquals(typeParameter.getBound().size(), 2);
+ assertEquals(typeParameter.getBound().get(0), Number.class.getName());
+ assertEquals(typeParameter.getBound().get(1), Runnable.class.getName());
+ }
+
+ /**
+ * testing integer annotation argument
+ */
+ @Test
+ public void testClass16() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class16.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation3.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance instance = classNode.getAnnotation().get(0);
+ AnnotationArgument argument = instance.getArgument().get(0);
+ assertEquals(argument.getName(), "id");
+ assertEquals(argument.getType().getQualified(), "int");
+ assertEquals(argument.getValue().size(), 1);
+ assertEquals(argument.getValue().get(0), "3");
+ assertTrue(argument.isPrimitive());
+ assertFalse(argument.isArray());
+ }
+
+ /**
+ * testing integer array annotation argument
+ */
+ @Test
+ public void testClass17() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class17.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation5.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance instance = classNode.getAnnotation().get(0);
+ AnnotationArgument argument = instance.getArgument().get(0);
+ assertEquals(argument.getType().getQualified(), "int");
+ assertEquals(argument.getValue().size(), 2);
+ assertEquals(argument.getValue().get(0), "1");
+ assertEquals(argument.getValue().get(1), "2");
+ assertTrue(argument.isPrimitive());
+ assertTrue(argument.isArray());
+ }
+
+ /**
+ * testing integer array annotation argument
+ */
+ @Test
+ public void testClass18() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class18.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation6.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance instance = classNode.getAnnotation().get(0);
+ AnnotationArgument argument = instance.getArgument().get(0);
+ assertEquals(argument.getType().getQualified(), "java.lang.String");
+ assertEquals(argument.getValue().size(), 1);
+ assertEquals(argument.getValue().get(0), "hey");
+ assertFalse(argument.isPrimitive());
+ assertFalse(argument.isArray());
+ }
+
+ /**
+ * testing enum annotation argument
+ */
+ @Test
+ public void testClass19() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class19.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation7.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum1.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance instance = classNode.getAnnotation().get(0);
+ AnnotationArgument argument = instance.getArgument().get(0);
+ assertEquals(argument.getType().getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Enum1");
+ assertEquals(argument.getValue().size(), 1);
+ assertEquals(argument.getValue().get(0), "a");
+ assertFalse(argument.isPrimitive());
+ assertFalse(argument.isArray());
+ }
+
+ /**
+ * testing class annotation argument
+ */
+ @Test
+ public void testClass20() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class20.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation8.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance instance = classNode.getAnnotation().get(0);
+ AnnotationArgument argument = instance.getArgument().get(0);
+ assertEquals(argument.getType().getQualified(), "java.lang.Class");
+ assertEquals(argument.getValue().size(), 1);
+ assertEquals(argument.getValue().get(0), "java.lang.String");
+ assertFalse(argument.isPrimitive());
+ assertFalse(argument.isArray());
+ }
+
+ /**
+ * testing character annotation argument
+ */
+ @Test
+ public void testClass21() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class21.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation10.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance instance = classNode.getAnnotation().get(0);
+ AnnotationArgument argument = instance.getArgument().get(0);
+ assertEquals(argument.getType().getQualified(), "char");
+ assertEquals(argument.getValue().size(), 1);
+ assertEquals(argument.getValue().get(0), Integer.toString((int) 'a'));
+ assertTrue(argument.isPrimitive());
+ assertFalse(argument.isArray());
+ }
+
+ /**
+ * testing 0 character annotation argument
+ */
+ @Test
+ public void testClass22() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class22.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation10.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance instance = classNode.getAnnotation().get(0);
+ AnnotationArgument argument = instance.getArgument().get(0);
+ assertEquals(argument.getType().getQualified(), "char");
+ assertEquals(argument.getValue().size(), 1);
+ assertEquals(argument.getValue().get(0), Integer.toString(0));
+ assertTrue(argument.isPrimitive());
+ assertFalse(argument.isArray());
+ }
+
+ /**
+ * testing boolean annotation argument
+ */
+ @Test
+ public void testClass23() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class23.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation11.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance instance = classNode.getAnnotation().get(0);
+ AnnotationArgument argument = instance.getArgument().get(0);
+ assertEquals(argument.getType().getQualified(), "boolean");
+ assertEquals(argument.getValue().size(), 1);
+ assertEquals(argument.getValue().get(0), Boolean.TRUE.toString());
+ assertTrue(argument.isPrimitive());
+ assertFalse(argument.isArray());
+ }
+
+ /**
+ * testing empty int array annotation argument
+ */
+ @Test
+ public void testClass24() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class24.java",
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation5.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ AnnotationInstance instance = classNode.getAnnotation().get(0);
+ AnnotationArgument argument = instance.getArgument().get(0);
+ assertEquals(argument.getType().getQualified(), "int");
+ assertEquals(argument.getValue().size(), 0);
+ assertTrue(argument.isPrimitive());
+ assertTrue(argument.isArray());
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/EnumTest.java b/src/test/java/com/github/markusbernhardt/xmldoclet/EnumTest.java
index 471e77a..190939d 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/EnumTest.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/EnumTest.java
@@ -1,146 +1,160 @@
-package com.github.markusbernhardt.xmldoclet;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import org.junit.Test;
-
-import com.github.markusbernhardt.xmldoclet.simpledata.Annotation12;
-import com.github.markusbernhardt.xmldoclet.xjc.AnnotationArgument;
-import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
-import com.github.markusbernhardt.xmldoclet.xjc.Enum;
-import com.github.markusbernhardt.xmldoclet.xjc.EnumConstant;
-import com.github.markusbernhardt.xmldoclet.xjc.Package;
-import com.github.markusbernhardt.xmldoclet.xjc.Root;
-
-/**
- * Unit test group for Enumerations
- */
-public class EnumTest extends AbstractTestParent {
-
- /**
- * Rigourous Parser :-)
- */
- @Test
- public void testSampledoc() {
- executeJavadoc(".", new String[] { "./src/test/java" }, null, null, new String[] { "com" },
- new String[] { "-dryrun" });
- }
-
- /**
- * testing a simple enum
- */
- @Test
- public void testEnum1() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum1.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Enum enumNode = packageNode.getEnum().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 1);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(enumNode.getName(), "Enum1");
- assertEquals(enumNode.getComment(), "Enum1");
- assertEquals(enumNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Enum1");
- assertEquals(enumNode.getConstant().size(), 3);
- assertEquals(enumNode.getConstant().get(0).getName(), "a");
- assertEquals(enumNode.getConstant().get(1).getName(), "b");
- assertEquals(enumNode.getConstant().get(2).getName(), "c");
- }
-
- /**
- * testing an empty enum
- */
- @Test
- public void testEnum2() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum2.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Enum enumNode = packageNode.getEnum().get(0);
-
- assertEquals(enumNode.getName(), "Enum2");
- assertEquals(enumNode.getComment(), "Enum2");
- assertEquals(enumNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Enum2");
- assertEquals(enumNode.getConstant().size(), 0);
- }
-
- /**
- * testing enum comment
- */
- @Test
- public void testEnum3() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum3.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Enum enumNode = packageNode.getEnum().get(0);
- assertEquals(enumNode.getComment(), "Enum3");
- }
-
- /**
- * testing enum field comment
- */
- @Test
- public void testEnum4() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum4.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Enum enumNode = packageNode.getEnum().get(0);
-
- EnumConstant enumConstantNode = enumNode.getConstant().get(0);
- assertEquals(enumConstantNode.getComment(), "field1");
- }
-
- /**
- * testing single annotation
- */
- @Test
- public void testEnum5() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum5.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Enum enumNode = packageNode.getEnum().get(0);
- assertEquals(enumNode.getAnnotation().size(), 1);
- AnnotationInstance annotationInstanceNode = enumNode.getAnnotation().get(0);
- assertEquals(annotationInstanceNode.getQualified(), "java.lang.Deprecated");
- }
-
- /**
- * testing multiple annotation
- */
- @Test
- public void testEnum6() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum6.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Enum enumNode = packageNode.getEnum().get(0);
- assertEquals(enumNode.getAnnotation().size(), 2);
-
- AnnotationInstance annotationInstanceNode = enumNode.getAnnotation().get(0);
- assertEquals(annotationInstanceNode.getQualified(), "java.lang.Deprecated");
- assertEquals(annotationInstanceNode.getName(), "Deprecated");
- assertEquals(annotationInstanceNode.getArgument().size(), 0);
-
- annotationInstanceNode = enumNode.getAnnotation().get(1);
- assertEquals(annotationInstanceNode.getQualified(), Annotation12.class.getName());
- assertEquals(annotationInstanceNode.getName(), Annotation12.class.getSimpleName());
- assertEquals(annotationInstanceNode.getArgument().size(), 1);
-
- AnnotationArgument annotationArgumentNode = annotationInstanceNode.getArgument().get(0);
- assertEquals(annotationArgumentNode.getName(), "value");
- assertEquals(annotationArgumentNode.getValue().get(0), "mister");
-
- }
-
-}
+package com.github.markusbernhardt.xmldoclet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+import com.github.markusbernhardt.xmldoclet.simpledata.Annotation12;
+import com.github.markusbernhardt.xmldoclet.xjc.AnnotationArgument;
+import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
+import com.github.markusbernhardt.xmldoclet.xjc.Enum;
+import com.github.markusbernhardt.xmldoclet.xjc.EnumConstant;
+import com.github.markusbernhardt.xmldoclet.xjc.Package;
+import com.github.markusbernhardt.xmldoclet.xjc.Root;
+
+/**
+ * Unit test group for Enumerations
+ */
+public class EnumTest extends AbstractTestParent {
+
+ /**
+ * Rigourous Parser :-)
+ */
+ @Test
+ public void testSampledoc() {
+ executeJavadoc(".", new String[] {"./src/test/java"}, null, null, new String[] {"com"},
+ new String[] {"-dryrun"});
+ }
+
+ /**
+ * testing a simple enum
+ */
+ @Test
+ public void testEnum1() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum1.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Enum enumNode = packageNode.getEnum().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 1);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(enumNode.getName(), "Enum1");
+ assertEquals(enumNode.getComment(), "Enum1");
+ assertEquals(enumNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Enum1");
+ assertEquals(enumNode.getConstant().size(), 3);
+ assertEquals(enumNode.getConstant().get(0).getName(), "a");
+ assertEquals(enumNode.getConstant().get(1).getName(), "b");
+ assertEquals(enumNode.getConstant().get(2).getName(), "c");
+ }
+
+ /**
+ * testing an empty enum
+ */
+ @Test
+ public void testEnum2() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum2.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Enum enumNode = packageNode.getEnum().get(0);
+
+ assertEquals(enumNode.getName(), "Enum2");
+ assertEquals(enumNode.getComment(), "Enum2");
+ assertEquals(enumNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Enum2");
+ assertEquals(enumNode.getConstant().size(), 0);
+ }
+
+ /**
+ * testing enum comment
+ */
+ @Test
+ public void testEnum3() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum3.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Enum enumNode = packageNode.getEnum().get(0);
+ assertEquals(enumNode.getComment(), "Enum3");
+ }
+
+ /**
+ * testing enum field comment
+ */
+ @Test
+ public void testEnum4() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum4.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Enum enumNode = packageNode.getEnum().get(0);
+
+ EnumConstant enumConstantNode = enumNode.getConstant().get(0);
+ assertEquals(enumConstantNode.getComment(), "field1");
+ }
+
+ /**
+ * testing single annotation
+ */
+ @Test
+ public void testEnum5() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum5.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Enum enumNode = packageNode.getEnum().get(0);
+ assertEquals(enumNode.getAnnotation().size(), 1);
+ AnnotationInstance annotationInstanceNode = enumNode.getAnnotation().get(0);
+ assertEquals(annotationInstanceNode.getQualified(), "java.lang.Deprecated");
+ }
+
+ /**
+ * testing multiple annotation
+ */
+ @Test
+ public void testEnum6() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum6.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Enum enumNode = packageNode.getEnum().get(0);
+ assertEquals(enumNode.getAnnotation().size(), 2);
+
+ AnnotationInstance annotationInstanceNode = enumNode.getAnnotation().get(0);
+ assertEquals(annotationInstanceNode.getQualified(), "java.lang.Deprecated");
+ assertEquals(annotationInstanceNode.getName(), "Deprecated");
+ assertEquals(annotationInstanceNode.getArgument().size(), 0);
+
+ annotationInstanceNode = enumNode.getAnnotation().get(1);
+ assertEquals(annotationInstanceNode.getQualified(), Annotation12.class.getName());
+ assertEquals(annotationInstanceNode.getName(), Annotation12.class.getSimpleName());
+ assertEquals(annotationInstanceNode.getArgument().size(), 1);
+
+ AnnotationArgument annotationArgumentNode = annotationInstanceNode.getArgument().get(0);
+ assertEquals(annotationArgumentNode.getName(), "value");
+ assertEquals(annotationArgumentNode.getValue().get(0), "mister");
+
+ }
+
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/FieldTest.java b/src/test/java/com/github/markusbernhardt/xmldoclet/FieldTest.java
index 7490d1d..984fdf7 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/FieldTest.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/FieldTest.java
@@ -1,192 +1,192 @@
-package com.github.markusbernhardt.xmldoclet;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.junit.Test;
-
-import com.github.markusbernhardt.xmldoclet.simpledata.Annotation12;
-import com.github.markusbernhardt.xmldoclet.xjc.AnnotationArgument;
-import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
-import com.github.markusbernhardt.xmldoclet.xjc.Class;
-import com.github.markusbernhardt.xmldoclet.xjc.Field;
-import com.github.markusbernhardt.xmldoclet.xjc.Package;
-import com.github.markusbernhardt.xmldoclet.xjc.Root;
-
-/**
- * Unit test group for Fields
- */
-public class FieldTest extends AbstractTestParent {
-
- /**
- * Rigourous Parser :-)
- */
- @Test
- public void testSampledoc() {
- executeJavadoc(".", new String[] { "./src/test/java" }, null, null, new String[] { "com" },
- new String[] { "-dryrun" });
- }
-
- /**
- * testing a returns of fields
- */
- @Test
- public void testMethod1() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Field1.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- List fields = classNode.getField();
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- // field0 -- test name
- Field field = findByFieldName("field0", fields);
- assertEquals(field.getName(), "field0");
-
- // field1 -- test public field
- field = findByFieldName("field1", fields);
- assertEquals(field.getScope(), "public");
-
- // field2 -- test private field
- field = findByFieldName("field2", fields);
- assertEquals(field.getScope(), "private");
-
- // field3 -- default scope field (non defined)
- field = findByFieldName("field3", fields);
- assertEquals(field.getScope(), "");
-
- // field4 -- protected scope field
- field = findByFieldName("field4", fields);
- assertEquals(field.getScope(), "protected");
-
- // field5 -- volatile field
- field = findByFieldName("field5", fields);
- assertTrue(field.isVolatile());
-
- // negative test of volatile
- assertFalse(findByFieldName("field4", fields).isVolatile());
-
- // field6 -- static field
- field = findByFieldName("field6", fields);
- assertTrue(field.isStatic());
-
- // negative test of static
- assertFalse(findByFieldName("field4", fields).isStatic());
-
- // field7 -- transient field
- field = findByFieldName("field7", fields);
- assertTrue(field.isTransient());
-
- // negative test of transient
- assertFalse(findByFieldName("field4", fields).isTransient());
-
- // field8 -- final field
- field = findByFieldName("field8", fields);
- assertTrue(field.isFinal());
-
- // negative test of final
- assertFalse(findByFieldName("field4", fields).isFinal());
-
- // field9 -- string final expression
- field = findByFieldName("field9", fields);
- assertEquals(field.getConstant(), "\"testy\"");
-
- // field10 -- int final expression
- field = findByFieldName("field10", fields);
- assertEquals(field.getConstant(), "10");
-
- // field11 -- annotation
- field = findByFieldName("field11", fields);
- assertEquals(field.getAnnotation().size(), 1);
-
- AnnotationInstance annotation = field.getAnnotation().get(0);
- assertEquals(annotation.getQualified(), "java.lang.Deprecated");
- assertEquals(annotation.getName(), "Deprecated");
- assertEquals(annotation.getArgument().size(), 0);
-
- // field12 -- two annotations
- field = findByFieldName("field12", fields);
- assertEquals(field.getAnnotation().size(), 2);
-
- annotation = field.getAnnotation().get(0);
- assertEquals(annotation.getQualified(), "java.lang.Deprecated");
- assertEquals(annotation.getName(), "Deprecated");
- assertEquals(annotation.getArgument().size(), 0);
-
- annotation = field.getAnnotation().get(1);
- assertEquals(annotation.getQualified(), Annotation12.class.getName());
- assertEquals(annotation.getName(), Annotation12.class.getSimpleName());
- assertEquals(annotation.getArgument().size(), 1);
-
- AnnotationArgument argument = annotation.getArgument().get(0);
- assertEquals(argument.getName(), "value");
- assertEquals(argument.getValue().get(0), "mister");
-
- // field13 - type testing
- field = findByFieldName("field13", fields);
- assertNotNull(field.getType());
- assertEquals(field.getType().getQualified(), "java.lang.String");
- assertNull(field.getType().getDimension());
- assertNull(field.getType().getWildcard());
- assertEquals(field.getType().getGeneric().size(), 0);
-
- // field14 - wild card
- field = findByFieldName("field14", fields);
- assertNotNull(field.getType());
- assertEquals(field.getType().getQualified(), "java.util.ArrayList");
- assertNotNull(field.getType().getGeneric());
- assertEquals(field.getType().getGeneric().size(), 1);
- assertEquals(field.getType().getGeneric().get(0).getQualified(), "?");
- assertNotNull(field.getType().getGeneric().get(0).getWildcard());
-
- // field15 - typed generic
- field = findByFieldName("field15", fields);
- assertNotNull(field.getType());
- assertEquals(field.getType().getQualified(), "java.util.HashMap");
- assertEquals(field.getType().getGeneric().size(), 2);
- assertEquals(field.getType().getGeneric().get(0).getQualified(), "java.lang.String");
- assertNull(field.getType().getGeneric().get(0).getWildcard());
- assertEquals(field.getType().getGeneric().get(1).getQualified(), "java.lang.Integer");
- assertNull(field.getType().getGeneric().get(1).getWildcard());
-
- // field16 - array
- field = findByFieldName("field16", fields);
- assertNotNull(field.getType());
- assertEquals(field.getType().getQualified(), "java.lang.String");
- assertEquals(field.getType().getDimension(), "[]");
- }
-
- /**
- * Short way of finding fields.
- *
- * @param fieldName
- * the shortname of the method
- * @param fields
- * the list of methods to look through.
- * @return The matching field
- */
- private Field findByFieldName(String fieldName, List fields) {
- for (Field field : fields) {
- if (field.getName().equals(fieldName)) {
- return field;
- }
- }
-
- fail();
- return null;
- }
-}
+package com.github.markusbernhardt.xmldoclet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import com.github.markusbernhardt.xmldoclet.simpledata.Annotation12;
+import com.github.markusbernhardt.xmldoclet.xjc.AnnotationArgument;
+import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
+import com.github.markusbernhardt.xmldoclet.xjc.Class;
+import com.github.markusbernhardt.xmldoclet.xjc.Field;
+import com.github.markusbernhardt.xmldoclet.xjc.Package;
+import com.github.markusbernhardt.xmldoclet.xjc.Root;
+
+/**
+ * Unit test group for Fields
+ */
+public class FieldTest extends AbstractTestParent {
+
+ /**
+ * Rigourous Parser :-)
+ */
+ @Test
+ public void testSampledoc() {
+ executeJavadoc(".", new String[] {"./src/test/java"}, null, null, new String[] {"com"},
+ new String[] {"-dryrun"});
+ }
+
+ /**
+ * testing a returns of fields
+ */
+ @Test
+ public void testMethod1() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Field1.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ List fields = classNode.getField();
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ // field0 -- test name
+ Field field = findByFieldName("field0", fields);
+ assertEquals(field.getName(), "field0");
+
+ // field1 -- test public field
+ field = findByFieldName("field1", fields);
+ assertEquals(field.getScope(), "public");
+
+ // field2 -- test private field
+ field = findByFieldName("field2", fields);
+ assertEquals(field.getScope(), "private");
+
+ // field3 -- default scope field (non defined)
+ field = findByFieldName("field3", fields);
+ assertEquals(field.getScope(), "");
+
+ // field4 -- protected scope field
+ field = findByFieldName("field4", fields);
+ assertEquals(field.getScope(), "protected");
+
+ // field5 -- volatile field
+ field = findByFieldName("field5", fields);
+ assertTrue(field.isVolatile());
+
+ // negative test of volatile
+ assertFalse(findByFieldName("field4", fields).isVolatile());
+
+ // field6 -- static field
+ field = findByFieldName("field6", fields);
+ assertTrue(field.isStatic());
+
+ // negative test of static
+ assertFalse(findByFieldName("field4", fields).isStatic());
+
+ // field7 -- transient field
+ field = findByFieldName("field7", fields);
+ assertTrue(field.isTransient());
+
+ // negative test of transient
+ assertFalse(findByFieldName("field4", fields).isTransient());
+
+ // field8 -- final field
+ field = findByFieldName("field8", fields);
+ assertTrue(field.isFinal());
+
+ // negative test of final
+ assertFalse(findByFieldName("field4", fields).isFinal());
+
+ // field9 -- string final expression
+ field = findByFieldName("field9", fields);
+ assertEquals(field.getConstant(), "\"testy\"");
+
+ // field10 -- int final expression
+ field = findByFieldName("field10", fields);
+ assertEquals(field.getConstant(), "10");
+
+ // field11 -- annotation
+ field = findByFieldName("field11", fields);
+ assertEquals(field.getAnnotation().size(), 1);
+
+ AnnotationInstance annotation = field.getAnnotation().get(0);
+ assertEquals(annotation.getQualified(), "java.lang.Deprecated");
+ assertEquals(annotation.getName(), "Deprecated");
+ assertEquals(annotation.getArgument().size(), 0);
+
+ // field12 -- two annotations
+ field = findByFieldName("field12", fields);
+ assertEquals(field.getAnnotation().size(), 2);
+
+ annotation = field.getAnnotation().get(0);
+ assertEquals(annotation.getQualified(), "java.lang.Deprecated");
+ assertEquals(annotation.getName(), "Deprecated");
+ assertEquals(annotation.getArgument().size(), 0);
+
+ annotation = field.getAnnotation().get(1);
+ assertEquals(annotation.getQualified(), Annotation12.class.getName());
+ assertEquals(annotation.getName(), Annotation12.class.getSimpleName());
+ assertEquals(annotation.getArgument().size(), 1);
+
+ AnnotationArgument argument = annotation.getArgument().get(0);
+ assertEquals(argument.getName(), "value");
+ assertEquals(argument.getValue().get(0), "mister");
+
+ // field13 - type testing
+ field = findByFieldName("field13", fields);
+ assertNotNull(field.getType());
+ assertEquals(field.getType().getQualified(), "java.lang.String");
+ assertNull(field.getType().getDimension());
+ assertNull(field.getType().getWildcard());
+ assertEquals(field.getType().getGeneric().size(), 0);
+
+ // field14 - wild card
+ field = findByFieldName("field14", fields);
+ assertNotNull(field.getType());
+ assertEquals(field.getType().getQualified(), "java.util.ArrayList");
+ assertNotNull(field.getType().getGeneric());
+ assertEquals(field.getType().getGeneric().size(), 1);
+ assertEquals(field.getType().getGeneric().get(0).getQualified(), "?");
+ assertNotNull(field.getType().getGeneric().get(0).getWildcard());
+
+ // field15 - typed generic
+ field = findByFieldName("field15", fields);
+ assertNotNull(field.getType());
+ assertEquals(field.getType().getQualified(), "java.util.HashMap");
+ assertEquals(field.getType().getGeneric().size(), 2);
+ assertEquals(field.getType().getGeneric().get(0).getQualified(), "java.lang.String");
+ assertNull(field.getType().getGeneric().get(0).getWildcard());
+ assertEquals(field.getType().getGeneric().get(1).getQualified(), "java.lang.Integer");
+ assertNull(field.getType().getGeneric().get(1).getWildcard());
+
+ // field16 - array
+ field = findByFieldName("field16", fields);
+ assertNotNull(field.getType());
+ assertEquals(field.getType().getQualified(), "java.lang.String");
+ assertEquals(field.getType().getDimension(), "[]");
+ }
+
+ /**
+ * Short way of finding fields.
+ *
+ * @param fieldName the shortname of the method
+ * @param fields the list of methods to look through.
+ * @return The matching field
+ */
+ private Field findByFieldName(String fieldName, List fields) {
+ for (Field field : fields) {
+ if (field.getName().equals(fieldName)) {
+ return field;
+ }
+ }
+
+ fail();
+ return null;
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/InterfaceTest.java b/src/test/java/com/github/markusbernhardt/xmldoclet/InterfaceTest.java
index 94c41f9..86769fe 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/InterfaceTest.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/InterfaceTest.java
@@ -1,326 +1,348 @@
-package com.github.markusbernhardt.xmldoclet;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-import com.github.markusbernhardt.xmldoclet.simpledata.Interface1;
-import com.github.markusbernhardt.xmldoclet.simpledata.Interface2;
-import com.github.markusbernhardt.xmldoclet.simpledata.Interface3;
-import com.github.markusbernhardt.xmldoclet.simpledata.Interface4;
-import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
-import com.github.markusbernhardt.xmldoclet.xjc.Interface;
-import com.github.markusbernhardt.xmldoclet.xjc.Method;
-import com.github.markusbernhardt.xmldoclet.xjc.Package;
-import com.github.markusbernhardt.xmldoclet.xjc.Root;
-import com.github.markusbernhardt.xmldoclet.xjc.TypeParameter;
-
-/**
- * Unit test group for Interfaces
- */
-@SuppressWarnings("deprecation")
-public class InterfaceTest extends AbstractTestParent {
-
- /**
- * Rigourous Parser :-)
- */
- @Test
- public void testSampledoc() {
- executeJavadoc(".", new String[] { "./src/test/java" }, null, null, new String[] { "com" },
- new String[] { "-dryrun" });
- }
-
- /**
- * testing a interface with nothing defined
- */
- @Test
- public void testInterface1() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface1.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Interface interfaceNode = packageNode.getInterface().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 1);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(interfaceNode.getComment(), "Interface1");
- assertEquals(interfaceNode.getName(), Interface1.class.getSimpleName());
- assertEquals(interfaceNode.getQualified(), Interface1.class.getName());
- assertEquals(interfaceNode.getScope(), "public");
- assertEquals(interfaceNode.getMethod().size(), 0);
- assertEquals(interfaceNode.getAnnotation().size(), 0);
- assertEquals(interfaceNode.getInterface().size(), 0);
- assertTrue(interfaceNode.isIncluded());
- }
-
- /**
- * testing a interface with 1 method
- */
- @Test
- public void testInterface2() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface2.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Interface interfaceNode = packageNode.getInterface().get(0);
- Method method = interfaceNode.getMethod().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 1);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(interfaceNode.getComment(), "Interface2");
- assertEquals(interfaceNode.getName(), Interface2.class.getSimpleName());
- assertEquals(interfaceNode.getQualified(), Interface2.class.getName());
- assertEquals(interfaceNode.getScope(), "public");
- assertEquals(interfaceNode.getMethod().size(), 1);
- assertEquals(interfaceNode.getAnnotation().size(), 0);
- assertEquals(interfaceNode.getInterface().size(), 0);
- assertTrue(interfaceNode.isIncluded());
-
- // verify method
- assertEquals(method.getComment(), "method1");
- assertEquals(method.getName(), "method1");
- assertEquals(method.getSignature(), "()");
- assertFalse(method.isFinal());
- assertFalse(method.isNative());
- assertFalse(method.isStatic());
- assertFalse(method.isSynchronized());
- assertFalse(method.isVarArgs());
- assertEquals(method.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Interface2.method1");
- assertEquals(method.getScope(), "public");
- assertEquals(method.getAnnotation().size(), 0);
- assertEquals(method.getParameter().size(), 0);
- assertEquals(method.getException().size(), 0);
-
- }
-
- /**
- * testing a interface that extends another interface
- */
- @Test
- public void testInterface3() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface3.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Interface interfaceNode = packageNode.getInterface().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 1);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(interfaceNode.getComment(), "Interface3");
- assertEquals(interfaceNode.getName(), Interface3.class.getSimpleName());
- assertEquals(interfaceNode.getQualified(), Interface3.class.getName());
- assertEquals(interfaceNode.getScope(), "public");
- assertEquals(interfaceNode.getMethod().size(), 0);
- assertEquals(interfaceNode.getAnnotation().size(), 0);
- assertEquals(interfaceNode.getInterface().size(), 1);
- assertTrue(interfaceNode.isIncluded());
-
- // verify interface
- assertEquals(interfaceNode.getInterface().get(0).getQualified(), java.io.Serializable.class.getName());
- }
-
- /**
- * testing a interface that implements one annotation
- */
- @Test
- public void testInterface4() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface4.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Interface interfaceNode = packageNode.getInterface().get(0);
- AnnotationInstance annotationInstanceNode = interfaceNode.getAnnotation().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 1);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(interfaceNode.getComment(), "Interface4");
- assertEquals(interfaceNode.getName(), Interface4.class.getSimpleName());
- assertEquals(interfaceNode.getQualified(), Interface4.class.getName());
- assertEquals(interfaceNode.getScope(), "public");
- assertEquals(interfaceNode.getMethod().size(), 0);
- assertEquals(interfaceNode.getAnnotation().size(), 1);
- assertEquals(interfaceNode.getInterface().size(), 0);
- assertTrue(interfaceNode.isIncluded());
-
- // verify deprecated annotation
- // test annotation 'deprecated' on class
- assertEquals(annotationInstanceNode.getQualified(), "java.lang.Deprecated");
- assertEquals(annotationInstanceNode.getName(), "Deprecated");
- assertEquals(annotationInstanceNode.getArgument().size(), 0);
- }
-
- /**
- * testing a interface that is abstract
- */
- @Test
- public void testInterface5() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface5.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Interface interfaceNode = packageNode.getInterface().get(0);
- Method method = interfaceNode.getMethod().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 1);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(interfaceNode.getComment(), "Interface5");
- assertEquals(interfaceNode.getName(), "Interface5");
- assertEquals(interfaceNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Interface5");
- assertEquals(interfaceNode.getScope(), "");
- assertEquals(interfaceNode.getMethod().size(), 1);
- assertEquals(interfaceNode.getAnnotation().size(), 0);
- assertEquals(interfaceNode.getInterface().size(), 0);
- assertTrue(interfaceNode.isIncluded());
-
- // verify method
- assertEquals(method.getComment(), "method1");
- assertEquals(method.getName(), "method1");
- assertEquals(method.getSignature(), "()");
- assertFalse(method.isFinal());
- assertFalse(method.isNative());
- assertFalse(method.isStatic());
- assertFalse(method.isSynchronized());
- assertFalse(method.isVarArgs());
- assertEquals(method.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Interface5.method1");
-
- // all interface methods are public
- assertEquals(method.getScope(), "public");
- assertEquals(method.getAnnotation().size(), 0);
- assertEquals(method.getParameter().size(), 0);
- assertEquals(method.getException().size(), 0);
- }
-
- /**
- * testing a interface that has a type variable
- */
- @Test
- public void testInterface6() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface6.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Interface interfaceNode = packageNode.getInterface().get(0);
- TypeParameter typeParameterNode = interfaceNode.getGeneric().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 1);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(interfaceNode.getComment(), "Interface6");
- assertEquals(interfaceNode.getName(), "Interface6");
- assertEquals(interfaceNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Interface6");
- assertEquals(interfaceNode.getScope(), "public");
- assertEquals(interfaceNode.getMethod().size(), 0);
- assertEquals(interfaceNode.getAnnotation().size(), 0);
- assertEquals(interfaceNode.getInterface().size(), 0);
- assertTrue(interfaceNode.isIncluded());
-
- assertEquals(typeParameterNode.getName(), "Fun");
- assertEquals(typeParameterNode.getBound().size(), 0);
- }
-
- /**
- * testing a interface that has a type variable with extends
- */
- @Test
- public void testInterface7() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface7.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Interface interfaceNode = packageNode.getInterface().get(0);
- TypeParameter typeParameterNode = interfaceNode.getGeneric().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 1);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(interfaceNode.getComment(), "Interface7");
- assertEquals(interfaceNode.getName(), "Interface7");
- assertEquals(interfaceNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Interface7");
- assertEquals(interfaceNode.getScope(), "public");
- assertEquals(interfaceNode.getMethod().size(), 0);
- assertEquals(interfaceNode.getAnnotation().size(), 0);
- assertEquals(interfaceNode.getInterface().size(), 0);
- assertTrue(interfaceNode.isIncluded());
-
- assertEquals(typeParameterNode.getBound().size(), 1);
- assertEquals(typeParameterNode.getBound().get(0), "java.lang.Number");
- }
-
- /**
- * testing a interface that has a type variable with extends of a class and
- * interface
- */
- @Test
- public void testInterface8() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface8.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Interface interfaceNode = packageNode.getInterface().get(0);
- TypeParameter typeParameterNode = interfaceNode.getGeneric().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 1);
- assertEquals(packageNode.getClazz().size(), 0);
-
- assertEquals(interfaceNode.getComment(), "Interface8");
- assertEquals(interfaceNode.getName(), "Interface8");
- assertEquals(interfaceNode.getQualified(), "com.github.markusbernhardt.xmldoclet.simpledata.Interface8");
- assertEquals(interfaceNode.getScope(), "public");
- assertEquals(interfaceNode.getMethod().size(), 0);
- assertEquals(interfaceNode.getAnnotation().size(), 0);
- assertEquals(interfaceNode.getInterface().size(), 0);
- assertTrue(interfaceNode.isIncluded());
-
- assertEquals(typeParameterNode.getBound().size(), 2);
- assertEquals(typeParameterNode.getBound().get(0), "java.lang.Number");
- assertEquals(typeParameterNode.getBound().get(1), "java.lang.Runnable");
- }
-}
+package com.github.markusbernhardt.xmldoclet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.github.markusbernhardt.xmldoclet.simpledata.Interface1;
+import com.github.markusbernhardt.xmldoclet.simpledata.Interface2;
+import com.github.markusbernhardt.xmldoclet.simpledata.Interface3;
+import com.github.markusbernhardt.xmldoclet.simpledata.Interface4;
+import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
+import com.github.markusbernhardt.xmldoclet.xjc.Interface;
+import com.github.markusbernhardt.xmldoclet.xjc.Method;
+import com.github.markusbernhardt.xmldoclet.xjc.Package;
+import com.github.markusbernhardt.xmldoclet.xjc.Root;
+import com.github.markusbernhardt.xmldoclet.xjc.TypeParameter;
+
+/**
+ * Unit test group for Interfaces
+ */
+@SuppressWarnings("deprecation")
+public class InterfaceTest extends AbstractTestParent {
+
+ /**
+ * Rigourous Parser :-)
+ */
+ @Test
+ public void testSampledoc() {
+ executeJavadoc(".", new String[] {"./src/test/java"}, null, null, new String[] {"com"},
+ new String[] {"-dryrun"});
+ }
+
+ /**
+ * testing a interface with nothing defined
+ */
+ @Test
+ public void testInterface1() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface1.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Interface interfaceNode = packageNode.getInterface().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 1);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(interfaceNode.getComment(), "Interface1");
+ assertEquals(interfaceNode.getName(), Interface1.class.getSimpleName());
+ assertEquals(interfaceNode.getQualified(), Interface1.class.getName());
+ assertEquals(interfaceNode.getScope(), "public");
+ assertEquals(interfaceNode.getMethod().size(), 0);
+ assertEquals(interfaceNode.getAnnotation().size(), 0);
+ assertEquals(interfaceNode.getInterface().size(), 0);
+ assertTrue(interfaceNode.isIncluded());
+ }
+
+ /**
+ * testing a interface with 1 method
+ */
+ @Test
+ public void testInterface2() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface2.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Interface interfaceNode = packageNode.getInterface().get(0);
+ Method method = interfaceNode.getMethod().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 1);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(interfaceNode.getComment(), "Interface2");
+ assertEquals(interfaceNode.getName(), Interface2.class.getSimpleName());
+ assertEquals(interfaceNode.getQualified(), Interface2.class.getName());
+ assertEquals(interfaceNode.getScope(), "public");
+ assertEquals(interfaceNode.getMethod().size(), 1);
+ assertEquals(interfaceNode.getAnnotation().size(), 0);
+ assertEquals(interfaceNode.getInterface().size(), 0);
+ assertTrue(interfaceNode.isIncluded());
+
+ // verify method
+ assertEquals(method.getComment(), "method1");
+ assertEquals(method.getName(), "method1");
+ assertEquals(method.getSignature(), "()");
+ assertFalse(method.isFinal());
+ assertFalse(method.isNative());
+ assertFalse(method.isStatic());
+ assertFalse(method.isSynchronized());
+ assertFalse(method.isVarArgs());
+ assertEquals(method.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Interface2.method1");
+ assertEquals(method.getScope(), "public");
+ assertEquals(method.getAnnotation().size(), 0);
+ assertEquals(method.getParameter().size(), 0);
+ assertEquals(method.getException().size(), 0);
+
+ }
+
+ /**
+ * testing a interface that extends another interface
+ */
+ @Test
+ public void testInterface3() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface3.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Interface interfaceNode = packageNode.getInterface().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 1);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(interfaceNode.getComment(), "Interface3");
+ assertEquals(interfaceNode.getName(), Interface3.class.getSimpleName());
+ assertEquals(interfaceNode.getQualified(), Interface3.class.getName());
+ assertEquals(interfaceNode.getScope(), "public");
+ assertEquals(interfaceNode.getMethod().size(), 0);
+ assertEquals(interfaceNode.getAnnotation().size(), 0);
+ assertEquals(interfaceNode.getInterface().size(), 1);
+ assertTrue(interfaceNode.isIncluded());
+
+ // verify interface
+ assertEquals(interfaceNode.getInterface().get(0).getQualified(),
+ java.io.Serializable.class.getName());
+ }
+
+ /**
+ * testing a interface that implements one annotation
+ */
+ @Test
+ public void testInterface4() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface4.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Interface interfaceNode = packageNode.getInterface().get(0);
+ AnnotationInstance annotationInstanceNode = interfaceNode.getAnnotation().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 1);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(interfaceNode.getComment(), "Interface4");
+ assertEquals(interfaceNode.getName(), Interface4.class.getSimpleName());
+ assertEquals(interfaceNode.getQualified(), Interface4.class.getName());
+ assertEquals(interfaceNode.getScope(), "public");
+ assertEquals(interfaceNode.getMethod().size(), 0);
+ assertEquals(interfaceNode.getAnnotation().size(), 1);
+ assertEquals(interfaceNode.getInterface().size(), 0);
+ assertTrue(interfaceNode.isIncluded());
+
+ // verify deprecated annotation
+ // test annotation 'deprecated' on class
+ assertEquals(annotationInstanceNode.getQualified(), "java.lang.Deprecated");
+ assertEquals(annotationInstanceNode.getName(), "Deprecated");
+ assertEquals(annotationInstanceNode.getArgument().size(), 0);
+ }
+
+ /**
+ * testing a interface that is abstract
+ */
+ @Test
+ public void testInterface5() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface5.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Interface interfaceNode = packageNode.getInterface().get(0);
+ Method method = interfaceNode.getMethod().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 1);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(interfaceNode.getComment(), "Interface5");
+ assertEquals(interfaceNode.getName(), "Interface5");
+ assertEquals(interfaceNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Interface5");
+ assertEquals(interfaceNode.getScope(), "");
+ assertEquals(interfaceNode.getMethod().size(), 1);
+ assertEquals(interfaceNode.getAnnotation().size(), 0);
+ assertEquals(interfaceNode.getInterface().size(), 0);
+ assertTrue(interfaceNode.isIncluded());
+
+ // verify method
+ assertEquals(method.getComment(), "method1");
+ assertEquals(method.getName(), "method1");
+ assertEquals(method.getSignature(), "()");
+ assertFalse(method.isFinal());
+ assertFalse(method.isNative());
+ assertFalse(method.isStatic());
+ assertFalse(method.isSynchronized());
+ assertFalse(method.isVarArgs());
+ assertEquals(method.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Interface5.method1");
+
+ // all interface methods are public
+ assertEquals(method.getScope(), "public");
+ assertEquals(method.getAnnotation().size(), 0);
+ assertEquals(method.getParameter().size(), 0);
+ assertEquals(method.getException().size(), 0);
+ }
+
+ /**
+ * testing a interface that has a type variable
+ */
+ @Test
+ public void testInterface6() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface6.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Interface interfaceNode = packageNode.getInterface().get(0);
+ TypeParameter typeParameterNode = interfaceNode.getGeneric().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 1);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(interfaceNode.getComment(), "Interface6");
+ assertEquals(interfaceNode.getName(), "Interface6");
+ assertEquals(interfaceNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Interface6");
+ assertEquals(interfaceNode.getScope(), "public");
+ assertEquals(interfaceNode.getMethod().size(), 0);
+ assertEquals(interfaceNode.getAnnotation().size(), 0);
+ assertEquals(interfaceNode.getInterface().size(), 0);
+ assertTrue(interfaceNode.isIncluded());
+
+ assertEquals(typeParameterNode.getName(), "Fun");
+ assertEquals(typeParameterNode.getBound().size(), 0);
+ }
+
+ /**
+ * testing a interface that has a type variable with extends
+ */
+ @Test
+ public void testInterface7() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface7.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Interface interfaceNode = packageNode.getInterface().get(0);
+ TypeParameter typeParameterNode = interfaceNode.getGeneric().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 1);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(interfaceNode.getComment(), "Interface7");
+ assertEquals(interfaceNode.getName(), "Interface7");
+ assertEquals(interfaceNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Interface7");
+ assertEquals(interfaceNode.getScope(), "public");
+ assertEquals(interfaceNode.getMethod().size(), 0);
+ assertEquals(interfaceNode.getAnnotation().size(), 0);
+ assertEquals(interfaceNode.getInterface().size(), 0);
+ assertTrue(interfaceNode.isIncluded());
+
+ assertEquals(typeParameterNode.getBound().size(), 1);
+ assertEquals(typeParameterNode.getBound().get(0), "java.lang.Number");
+ }
+
+ /**
+ * testing a interface that has a type variable with extends of a class and interface
+ */
+ @Test
+ public void testInterface8() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface8.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Interface interfaceNode = packageNode.getInterface().get(0);
+ TypeParameter typeParameterNode = interfaceNode.getGeneric().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 1);
+ assertEquals(packageNode.getClazz().size(), 0);
+
+ assertEquals(interfaceNode.getComment(), "Interface8");
+ assertEquals(interfaceNode.getName(), "Interface8");
+ assertEquals(interfaceNode.getQualified(),
+ "com.github.markusbernhardt.xmldoclet.simpledata.Interface8");
+ assertEquals(interfaceNode.getScope(), "public");
+ assertEquals(interfaceNode.getMethod().size(), 0);
+ assertEquals(interfaceNode.getAnnotation().size(), 0);
+ assertEquals(interfaceNode.getInterface().size(), 0);
+ assertTrue(interfaceNode.isIncluded());
+
+ assertEquals(typeParameterNode.getBound().size(), 2);
+ assertEquals(typeParameterNode.getBound().get(0), "java.lang.Number");
+ assertEquals(typeParameterNode.getBound().get(1), "java.lang.Runnable");
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/MethodTest.java b/src/test/java/com/github/markusbernhardt/xmldoclet/MethodTest.java
index dc17ffe..e42d7bb 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/MethodTest.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/MethodTest.java
@@ -1,391 +1,398 @@
-package com.github.markusbernhardt.xmldoclet;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.junit.Test;
-
-import com.github.markusbernhardt.xmldoclet.simpledata.Annotation12;
-import com.github.markusbernhardt.xmldoclet.xjc.AnnotationArgument;
-import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
-import com.github.markusbernhardt.xmldoclet.xjc.Class;
-import com.github.markusbernhardt.xmldoclet.xjc.Method;
-import com.github.markusbernhardt.xmldoclet.xjc.MethodParameter;
-import com.github.markusbernhardt.xmldoclet.xjc.Package;
-import com.github.markusbernhardt.xmldoclet.xjc.Root;
-import com.github.markusbernhardt.xmldoclet.xjc.TypeInfo;
-import com.github.markusbernhardt.xmldoclet.xjc.Wildcard;
-
-/**
- * Unit test group for Methods
- */
-public class MethodTest extends AbstractTestParent {
-
- /**
- * Rigourous Parser :-)
- */
- @Test
- public void testSampledoc() {
- executeJavadoc(".", new String[] { "./src/test/java" }, null, null, new String[] { "com" },
- new String[] { "-dryrun" });
- }
-
- /**
- * testing a returns of methodNodes
- */
- @Test
- public void testMethod1() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method1.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- List testMethods = classNode.getMethod();
-
- // with methodNode1 we are checking that a simple methodNode can exist
- // with no arguments and no return
- Method methodNode = findByMethodName("method1", testMethods);
- assertEquals(methodNode.getReturn().getQualified(), "void");
- assertEquals(methodNode.getReturn().getGeneric().size(), 0);
- assertNull(methodNode.getReturn().getWildcard());
- assertNull(methodNode.getReturn().getDimension());
-
- // methodNode2 - checking Object based returns
- methodNode = findByMethodName("method2", testMethods);
- assertEquals(methodNode.getReturn().getQualified(), "java.lang.Integer");
- assertEquals(methodNode.getReturn().getGeneric().size(), 0);
- assertNull(methodNode.getReturn().getWildcard());
- assertNull(methodNode.getReturn().getDimension());
-
- // methodNode 3 - checking primitive based returns
- methodNode = findByMethodName("method3", testMethods);
- assertEquals(methodNode.getReturn().getQualified(), "int");
- assertEquals(methodNode.getReturn().getGeneric().size(), 0);
- assertNull(methodNode.getReturn().getWildcard());
- assertNull(methodNode.getReturn().getDimension());
- }
-
- /**
- * testing arguments of methodNodes
- */
- @Test
- public void testMethod2() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method2.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- List testMethods = classNode.getMethod();
-
- // methodNode - methodNode with no arguments
- Method methodNode = findByMethodName("method1", testMethods);
- assertEquals(methodNode.getParameter().size(), 0);
- assertEquals(methodNode.getSignature(), "()");
-
- // methodNode2 - methodNode with one Object-derived argument
- methodNode = findByMethodName("method2", testMethods);
- assertEquals(methodNode.getParameter().size(), 1);
- assertEquals(methodNode.getSignature(), "(" + Integer.class.getName() + ")");
-
- // one should be able to reliably access getParameter() in this fashion
- // since XML order is important, and order of getParameter() to
- // methodNodes is
- // likewise important. ORDER MATTERS AND SHOULD BE TRUSTY!
- MethodParameter methodParameterNode = methodNode.getParameter().get(0);
- assertEquals(methodParameterNode.getType().getQualified(), "java.lang.Integer");
-
- // methodNode3 - check primitive argument
- methodNode = findByMethodName("method3", testMethods);
- assertEquals(methodNode.getParameter().size(), 1);
- assertEquals(methodNode.getSignature(), "(int)");
-
- methodParameterNode = methodNode.getParameter().get(0);
- assertEquals(methodParameterNode.getType().getQualified(), "int");
- assertNull(methodParameterNode.getType().getDimension());
- assertEquals(methodParameterNode.getType().getGeneric().size(), 0);
- assertNull(methodParameterNode.getType().getWildcard());
-
- // methodNode4 - check that two args are OK
- methodNode = findByMethodName("method4", testMethods);
- assertEquals(methodNode.getParameter().size(), 2);
- assertEquals(methodNode.getSignature(), "(" + Integer.class.getName() + ", " + Integer.class.getName() + ")");
-
- methodParameterNode = methodNode.getParameter().get(0);
- assertEquals(methodParameterNode.getType().getQualified(), "java.lang.Integer");
-
- methodParameterNode = methodNode.getParameter().get(1);
- assertEquals(methodParameterNode.getType().getQualified(), "java.lang.Integer");
-
- // methodNode5 - check that a generic argument is valid
- methodNode = findByMethodName("method5", testMethods);
- assertEquals(methodNode.getParameter().size(), 1);
- assertEquals(methodNode.getSignature(), "(java.util.ArrayList)");
-
- methodParameterNode = methodNode.getParameter().get(0);
- assertEquals(methodParameterNode.getName(), "arg1");
- assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
- assertNull(methodParameterNode.getType().getDimension());
- assertNull(methodParameterNode.getType().getWildcard());
- assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
-
- TypeInfo type = methodParameterNode.getType().getGeneric().get(0);
- assertEquals(type.getQualified(), "java.lang.String");
- assertNull(type.getDimension());
- assertNull(type.getWildcard());
- assertEquals(type.getGeneric().size(), 0);
-
- // methodNode6 - check that a wildcard argument is valid
- methodNode = findByMethodName("method6", testMethods);
- assertEquals(methodNode.getParameter().size(), 1);
- assertEquals(methodNode.getSignature(), "(java.util.ArrayList>)");
-
- methodParameterNode = methodNode.getParameter().get(0);
- assertEquals(methodParameterNode.getName(), "arg1");
- assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
- assertNull(methodParameterNode.getType().getDimension());
- assertNull(methodParameterNode.getType().getWildcard());
- assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
-
- type = methodParameterNode.getType().getGeneric().get(0);
- assertEquals(type.getQualified(), "?");
- assertNull(type.getDimension());
- assertNotNull(type.getWildcard());
- assertEquals(type.getGeneric().size(), 0);
-
- Wildcard wildcard = type.getWildcard();
- assertEquals(wildcard.getExtendsBound().size(), 0);
- assertEquals(wildcard.getSuperBound().size(), 0);
-
- // methodNode7 - check that a wildcard argument is valid with extends
- // clause
- methodNode = findByMethodName("method7", testMethods);
- assertEquals(methodNode.getParameter().size(), 1);
- assertEquals(methodNode.getSignature(), "(java.util.ArrayList extends java.lang.String>)");
-
- methodParameterNode = methodNode.getParameter().get(0);
- assertEquals(methodParameterNode.getName(), "arg1");
- assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
- assertEquals(methodParameterNode.getType().getDimension(), null);
- assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
- assertNull(methodParameterNode.getType().getWildcard());
-
- type = methodParameterNode.getType().getGeneric().get(0);
- assertEquals(type.getQualified(), "?");
- assertEquals(type.getDimension(), null);
- assertEquals(type.getGeneric().size(), 0);
- assertNotNull(type.getWildcard());
-
- wildcard = type.getWildcard();
- assertEquals(wildcard.getExtendsBound().size(), 1);
- assertEquals(wildcard.getSuperBound().size(), 0);
-
- TypeInfo extendsBound = wildcard.getExtendsBound().get(0);
- assertEquals(extendsBound.getQualified(), "java.lang.String");
- assertEquals(extendsBound.getDimension(), null);
- assertEquals(extendsBound.getGeneric().size(), 0);
- assertNull(extendsBound.getWildcard());
-
- // methodNode8 - check that a wildcard argument is valid with super
- // clause
- methodNode = findByMethodName("method8", testMethods);
- assertEquals(methodNode.getParameter().size(), 1);
- assertEquals(methodNode.getSignature(), "(java.util.ArrayList super java.lang.String>)");
-
- methodParameterNode = methodNode.getParameter().get(0);
- assertEquals(methodParameterNode.getName(), "arg1");
- assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
- assertEquals(methodParameterNode.getType().getDimension(), null);
- assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
- assertNull(methodParameterNode.getType().getWildcard());
-
- type = methodParameterNode.getType().getGeneric().get(0);
- assertEquals(type.getQualified(), "?");
- assertEquals(type.getDimension(), null);
- assertEquals(type.getGeneric().size(), 0);
- assertNotNull(type.getWildcard());
-
- wildcard = type.getWildcard();
- assertEquals(wildcard.getSuperBound().size(), 1);
- assertEquals(wildcard.getExtendsBound().size(), 0);
-
- TypeInfo superBounds = wildcard.getSuperBound().get(0);
- assertEquals(superBounds.getQualified(), "java.lang.String");
- assertEquals(superBounds.getDimension(), null);
- assertEquals(superBounds.getGeneric().size(), 0);
- assertNull(superBounds.getWildcard());
-
- // methodNode9 - check that a two-level deep nested generic
- methodNode = findByMethodName("method9", testMethods);
- assertEquals(methodNode.getParameter().size(), 1);
- assertEquals(methodNode.getSignature(), "(java.util.ArrayList>)");
-
- methodParameterNode = methodNode.getParameter().get(0);
- assertEquals(methodParameterNode.getName(), "arg1");
- assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
- assertEquals(methodParameterNode.getType().getDimension(), null);
- assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
- assertNull(methodParameterNode.getType().getWildcard());
-
- type = methodParameterNode.getType().getGeneric().get(0);
- assertEquals(type.getQualified(), "java.util.ArrayList");
- assertEquals(type.getDimension(), null);
- assertEquals(type.getGeneric().size(), 1);
- assertNull(type.getWildcard());
-
- type = type.getGeneric().get(0);
- assertEquals(type.getQualified(), "java.lang.String");
- assertEquals(type.getDimension(), null);
- assertEquals(type.getGeneric().size(), 0);
- assertNull(type.getWildcard());
-
- // methodNode10 - check var args
- methodNode = findByMethodName("method10", testMethods);
- assertEquals(methodNode.getParameter().size(), 1);
- assertEquals(methodNode.getSignature(), "(java.lang.Object...)");
- assertTrue(methodNode.isVarArgs());
-
- methodParameterNode = methodNode.getParameter().get(0);
- assertEquals(methodParameterNode.getName(), "object");
- assertEquals(methodParameterNode.getType().getQualified(), "java.lang.Object");
- assertEquals(methodParameterNode.getType().getDimension(), "[]");
-
- // methodNode9--check var args negative test
- assertFalse(findByMethodName("method9", testMethods).isVarArgs());
- }
-
- /**
- * testing methodNode properties
- */
- @Test
- public void testMethod3() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method3.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
- List testMethods = classNode.getMethod();
-
- // methodNode1 -- we check public scope
- Method methodNode = findByMethodName("method1", testMethods);
- assertEquals(methodNode.getScope(), "public");
-
- // methodNode2 -- we check package scope
- methodNode = findByMethodName("method2", testMethods);
- assertEquals(methodNode.getScope(), "");
-
- // methodNode3 -- we check private scope
- methodNode = findByMethodName("method3", testMethods);
- assertEquals(methodNode.getScope(), "private");
-
- // methodNode4 -- we check private scope
- methodNode = findByMethodName("method4", testMethods);
- assertEquals(methodNode.getScope(), "protected");
-
- // methodNode5 -- we check native
- methodNode = findByMethodName("method5", testMethods);
- assertTrue(methodNode.isNative());
- // and negative
- assertFalse(findByMethodName("method4", testMethods).isNative());
-
- // methodNode6 -- we check static
- methodNode = findByMethodName("method6", testMethods);
- assertTrue(methodNode.isStatic());
- // and negative
- assertFalse(findByMethodName("method4", testMethods).isStatic());
-
- // methodNode7 -- we check final
- methodNode = findByMethodName("method7", testMethods);
- assertTrue(methodNode.isFinal());
- // and negative
- assertFalse(findByMethodName("method4", testMethods).isFinal());
-
- // methodNode8 -- we check synchronized
- methodNode = findByMethodName("method8", testMethods);
- assertTrue(methodNode.isSynchronized());
- // and negative
- assertFalse(findByMethodName("method4", testMethods).isSynchronized());
-
- // methodNode9 -- we check one thrown exception
- methodNode = findByMethodName("method9", testMethods);
- assertEquals(methodNode.getException().size(), 1);
-
- TypeInfo exception = methodNode.getException().get(0);
- assertEquals(exception.getQualified(), "java.lang.Exception");
- assertEquals(exception.getDimension(), null);
- assertEquals(exception.getGeneric().size(), 0);
- assertNull(exception.getWildcard());
-
- // methodNode10 -- we check two thrown exceptions
- methodNode = findByMethodName("method10", testMethods);
- assertEquals(methodNode.getException().size(), 2);
-
- exception = methodNode.getException().get(0);
- assertEquals(exception.getQualified(), "java.lang.OutOfMemoryError");
- assertEquals(exception.getDimension(), null);
- assertEquals(exception.getGeneric().size(), 0);
-
- exception = methodNode.getException().get(1);
- assertEquals(exception.getQualified(), "java.lang.IllegalArgumentException");
- assertEquals(exception.getDimension(), null);
- assertEquals(exception.getGeneric().size(), 0);
-
- // negative--no exceptions
- assertEquals(findByMethodName("method4", testMethods).getException().size(), 0);
-
- // methodNode11 -- 1 annotation instance
-
- methodNode = findByMethodName("method11", testMethods);
- assertEquals(methodNode.getAnnotation().size(), 1);
-
- AnnotationInstance annotation = methodNode.getAnnotation().get(0);
- assertEquals(annotation.getQualified(), "java.lang.Deprecated");
- assertEquals(annotation.getArgument().size(), 0);
-
- // methodNode12 -- 2 annotation instances
- methodNode = findByMethodName("method12", testMethods);
- assertEquals(methodNode.getAnnotation().size(), 2);
-
- annotation = methodNode.getAnnotation().get(0);
- assertEquals(annotation.getQualified(), "java.lang.Deprecated");
-
- annotation = methodNode.getAnnotation().get(1);
- assertEquals(annotation.getQualified(), Annotation12.class.getName());
- assertEquals(annotation.getArgument().size(), 1);
- AnnotationArgument annotArgument = annotation.getArgument().get(0);
- assertEquals(annotArgument.getName(), "value");
- assertEquals(annotArgument.getValue().get(0), "java.lang.Warning");
-
- // negative -- no annotations
- assertEquals(findByMethodName("method4", testMethods).getAnnotation().size(), 0);
-
- }
-
- /**
- * Short way of finding methodNodes. It's meant to only be used for
- * methodNodes that do not share the same name in the same class. In fact,
- * this class will junit assert that there is only 1 methodNode matching
- * this name in the supplied list
methodParameterNodeeter.
- *
- * @param methodNodeName
- * the shortname of the methodNode
- * @param methodNodes
- * the list of methodNodes to look through.
- * @return The matching methodNode
- */
- private Method findByMethodName(String methodNodeName, List methodNodes) {
- for (Method methodNode : methodNodes) {
- if (methodNode.getName().equals(methodNodeName)) {
- return methodNode;
- }
- }
-
- fail();
- return null;
- }
-}
+package com.github.markusbernhardt.xmldoclet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import com.github.markusbernhardt.xmldoclet.simpledata.Annotation12;
+import com.github.markusbernhardt.xmldoclet.xjc.AnnotationArgument;
+import com.github.markusbernhardt.xmldoclet.xjc.AnnotationInstance;
+import com.github.markusbernhardt.xmldoclet.xjc.Class;
+import com.github.markusbernhardt.xmldoclet.xjc.Method;
+import com.github.markusbernhardt.xmldoclet.xjc.MethodParameter;
+import com.github.markusbernhardt.xmldoclet.xjc.Package;
+import com.github.markusbernhardt.xmldoclet.xjc.Root;
+import com.github.markusbernhardt.xmldoclet.xjc.TypeInfo;
+import com.github.markusbernhardt.xmldoclet.xjc.Wildcard;
+
+/**
+ * Unit test group for Methods
+ */
+public class MethodTest extends AbstractTestParent {
+
+ /**
+ * Rigourous Parser :-)
+ */
+ @Test
+ public void testSampledoc() {
+ executeJavadoc(".", new String[] {"./src/test/java"}, null, null, new String[] {"com"},
+ new String[] {"-dryrun"});
+ }
+
+ /**
+ * testing a returns of methodNodes
+ */
+ @Test
+ public void testMethod1() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method1.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ List testMethods = classNode.getMethod();
+
+ // with methodNode1 we are checking that a simple methodNode can exist
+ // with no arguments and no return
+ Method methodNode = findByMethodName("method1", testMethods);
+ assertEquals(methodNode.getReturn().getQualified(), "void");
+ assertEquals(methodNode.getReturn().getGeneric().size(), 0);
+ assertNull(methodNode.getReturn().getWildcard());
+ assertNull(methodNode.getReturn().getDimension());
+
+ // methodNode2 - checking Object based returns
+ methodNode = findByMethodName("method2", testMethods);
+ assertEquals(methodNode.getReturn().getQualified(), "java.lang.Integer");
+ assertEquals(methodNode.getReturn().getGeneric().size(), 0);
+ assertNull(methodNode.getReturn().getWildcard());
+ assertNull(methodNode.getReturn().getDimension());
+
+ // methodNode 3 - checking primitive based returns
+ methodNode = findByMethodName("method3", testMethods);
+ assertEquals(methodNode.getReturn().getQualified(), "int");
+ assertEquals(methodNode.getReturn().getGeneric().size(), 0);
+ assertNull(methodNode.getReturn().getWildcard());
+ assertNull(methodNode.getReturn().getDimension());
+ }
+
+ /**
+ * testing arguments of methodNodes
+ */
+ @Test
+ public void testMethod2() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method2.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ List testMethods = classNode.getMethod();
+
+ // methodNode - methodNode with no arguments
+ Method methodNode = findByMethodName("method1", testMethods);
+ assertEquals(methodNode.getParameter().size(), 0);
+ assertEquals(methodNode.getSignature(), "()");
+
+ // methodNode2 - methodNode with one Object-derived argument
+ methodNode = findByMethodName("method2", testMethods);
+ assertEquals(methodNode.getParameter().size(), 1);
+ assertEquals(methodNode.getSignature(), "(" + Integer.class.getName() + ")");
+
+ // one should be able to reliably access getParameter() in this fashion
+ // since XML order is important, and order of getParameter() to
+ // methodNodes is
+ // likewise important. ORDER MATTERS AND SHOULD BE TRUSTY!
+ MethodParameter methodParameterNode = methodNode.getParameter().get(0);
+ assertEquals(methodParameterNode.getType().getQualified(), "java.lang.Integer");
+
+ // methodNode3 - check primitive argument
+ methodNode = findByMethodName("method3", testMethods);
+ assertEquals(methodNode.getParameter().size(), 1);
+ assertEquals(methodNode.getSignature(), "(int)");
+
+ methodParameterNode = methodNode.getParameter().get(0);
+ assertEquals(methodParameterNode.getType().getQualified(), "int");
+ assertNull(methodParameterNode.getType().getDimension());
+ assertEquals(methodParameterNode.getType().getGeneric().size(), 0);
+ assertNull(methodParameterNode.getType().getWildcard());
+
+ // methodNode4 - check that two args are OK
+ methodNode = findByMethodName("method4", testMethods);
+ assertEquals(methodNode.getParameter().size(), 2);
+ assertEquals(methodNode.getSignature(),
+ "(" + Integer.class.getName() + ", " + Integer.class.getName() + ")");
+
+ methodParameterNode = methodNode.getParameter().get(0);
+ assertEquals(methodParameterNode.getType().getQualified(), "java.lang.Integer");
+
+ methodParameterNode = methodNode.getParameter().get(1);
+ assertEquals(methodParameterNode.getType().getQualified(), "java.lang.Integer");
+
+ // methodNode5 - check that a generic argument is valid
+ methodNode = findByMethodName("method5", testMethods);
+ assertEquals(methodNode.getParameter().size(), 1);
+ assertEquals(methodNode.getSignature(), "(java.util.ArrayList)");
+
+ methodParameterNode = methodNode.getParameter().get(0);
+ assertEquals(methodParameterNode.getName(), "arg1");
+ assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
+ assertNull(methodParameterNode.getType().getDimension());
+ assertNull(methodParameterNode.getType().getWildcard());
+ assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
+
+ TypeInfo type = methodParameterNode.getType().getGeneric().get(0);
+ assertEquals(type.getQualified(), "java.lang.String");
+ assertNull(type.getDimension());
+ assertNull(type.getWildcard());
+ assertEquals(type.getGeneric().size(), 0);
+
+ // methodNode6 - check that a wildcard argument is valid
+ methodNode = findByMethodName("method6", testMethods);
+ assertEquals(methodNode.getParameter().size(), 1);
+ assertEquals(methodNode.getSignature(), "(java.util.ArrayList>)");
+
+ methodParameterNode = methodNode.getParameter().get(0);
+ assertEquals(methodParameterNode.getName(), "arg1");
+ assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
+ assertNull(methodParameterNode.getType().getDimension());
+ assertNull(methodParameterNode.getType().getWildcard());
+ assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
+
+ type = methodParameterNode.getType().getGeneric().get(0);
+ assertEquals(type.getQualified(), "?");
+ assertNull(type.getDimension());
+ assertNotNull(type.getWildcard());
+ assertEquals(type.getGeneric().size(), 0);
+
+ Wildcard wildcard = type.getWildcard();
+ assertEquals(wildcard.getExtendsBound().size(), 0);
+ assertEquals(wildcard.getSuperBound().size(), 0);
+
+ // methodNode7 - check that a wildcard argument is valid with extends
+ // clause
+ methodNode = findByMethodName("method7", testMethods);
+ assertEquals(methodNode.getParameter().size(), 1);
+ assertEquals(methodNode.getSignature(),
+ "(java.util.ArrayList extends java.lang.String>)");
+
+ methodParameterNode = methodNode.getParameter().get(0);
+ assertEquals(methodParameterNode.getName(), "arg1");
+ assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
+ assertEquals(methodParameterNode.getType().getDimension(), null);
+ assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
+ assertNull(methodParameterNode.getType().getWildcard());
+
+ type = methodParameterNode.getType().getGeneric().get(0);
+ assertEquals(type.getQualified(), "?");
+ assertEquals(type.getDimension(), null);
+ assertEquals(type.getGeneric().size(), 0);
+ assertNotNull(type.getWildcard());
+
+ wildcard = type.getWildcard();
+ assertEquals(wildcard.getExtendsBound().size(), 1);
+ assertEquals(wildcard.getSuperBound().size(), 0);
+
+ TypeInfo extendsBound = wildcard.getExtendsBound().get(0);
+ assertEquals(extendsBound.getQualified(), "java.lang.String");
+ assertEquals(extendsBound.getDimension(), null);
+ assertEquals(extendsBound.getGeneric().size(), 0);
+ assertNull(extendsBound.getWildcard());
+
+ // methodNode8 - check that a wildcard argument is valid with super
+ // clause
+ methodNode = findByMethodName("method8", testMethods);
+ assertEquals(methodNode.getParameter().size(), 1);
+ assertEquals(methodNode.getSignature(), "(java.util.ArrayList super java.lang.String>)");
+
+ methodParameterNode = methodNode.getParameter().get(0);
+ assertEquals(methodParameterNode.getName(), "arg1");
+ assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
+ assertEquals(methodParameterNode.getType().getDimension(), null);
+ assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
+ assertNull(methodParameterNode.getType().getWildcard());
+
+ type = methodParameterNode.getType().getGeneric().get(0);
+ assertEquals(type.getQualified(), "?");
+ assertEquals(type.getDimension(), null);
+ assertEquals(type.getGeneric().size(), 0);
+ assertNotNull(type.getWildcard());
+
+ wildcard = type.getWildcard();
+ assertEquals(wildcard.getSuperBound().size(), 1);
+ assertEquals(wildcard.getExtendsBound().size(), 0);
+
+ TypeInfo superBounds = wildcard.getSuperBound().get(0);
+ assertEquals(superBounds.getQualified(), "java.lang.String");
+ assertEquals(superBounds.getDimension(), null);
+ assertEquals(superBounds.getGeneric().size(), 0);
+ assertNull(superBounds.getWildcard());
+
+ // methodNode9 - check that a two-level deep nested generic
+ methodNode = findByMethodName("method9", testMethods);
+ assertEquals(methodNode.getParameter().size(), 1);
+ assertEquals(methodNode.getSignature(),
+ "(java.util.ArrayList>)");
+
+ methodParameterNode = methodNode.getParameter().get(0);
+ assertEquals(methodParameterNode.getName(), "arg1");
+ assertEquals(methodParameterNode.getType().getQualified(), "java.util.ArrayList");
+ assertEquals(methodParameterNode.getType().getDimension(), null);
+ assertEquals(methodParameterNode.getType().getGeneric().size(), 1);
+ assertNull(methodParameterNode.getType().getWildcard());
+
+ type = methodParameterNode.getType().getGeneric().get(0);
+ assertEquals(type.getQualified(), "java.util.ArrayList");
+ assertEquals(type.getDimension(), null);
+ assertEquals(type.getGeneric().size(), 1);
+ assertNull(type.getWildcard());
+
+ type = type.getGeneric().get(0);
+ assertEquals(type.getQualified(), "java.lang.String");
+ assertEquals(type.getDimension(), null);
+ assertEquals(type.getGeneric().size(), 0);
+ assertNull(type.getWildcard());
+
+ // methodNode10 - check var args
+ methodNode = findByMethodName("method10", testMethods);
+ assertEquals(methodNode.getParameter().size(), 1);
+ assertEquals(methodNode.getSignature(), "(java.lang.Object...)");
+ assertTrue(methodNode.isVarArgs());
+
+ methodParameterNode = methodNode.getParameter().get(0);
+ assertEquals(methodParameterNode.getName(), "object");
+ assertEquals(methodParameterNode.getType().getQualified(), "java.lang.Object");
+ assertEquals(methodParameterNode.getType().getDimension(), "[]");
+
+ // methodNode9--check var args negative test
+ assertFalse(findByMethodName("method9", testMethods).isVarArgs());
+ }
+
+ /**
+ * testing methodNode properties
+ */
+ @Test
+ public void testMethod3() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method3.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+ List testMethods = classNode.getMethod();
+
+ // methodNode1 -- we check public scope
+ Method methodNode = findByMethodName("method1", testMethods);
+ assertEquals(methodNode.getScope(), "public");
+
+ // methodNode2 -- we check package scope
+ methodNode = findByMethodName("method2", testMethods);
+ assertEquals(methodNode.getScope(), "");
+
+ // methodNode3 -- we check private scope
+ methodNode = findByMethodName("method3", testMethods);
+ assertEquals(methodNode.getScope(), "private");
+
+ // methodNode4 -- we check private scope
+ methodNode = findByMethodName("method4", testMethods);
+ assertEquals(methodNode.getScope(), "protected");
+
+ // methodNode5 -- we check native
+ methodNode = findByMethodName("method5", testMethods);
+ assertTrue(methodNode.isNative());
+ // and negative
+ assertFalse(findByMethodName("method4", testMethods).isNative());
+
+ // methodNode6 -- we check static
+ methodNode = findByMethodName("method6", testMethods);
+ assertTrue(methodNode.isStatic());
+ // and negative
+ assertFalse(findByMethodName("method4", testMethods).isStatic());
+
+ // methodNode7 -- we check final
+ methodNode = findByMethodName("method7", testMethods);
+ assertTrue(methodNode.isFinal());
+ // and negative
+ assertFalse(findByMethodName("method4", testMethods).isFinal());
+
+ // methodNode8 -- we check synchronized
+ methodNode = findByMethodName("method8", testMethods);
+ assertTrue(methodNode.isSynchronized());
+ // and negative
+ assertFalse(findByMethodName("method4", testMethods).isSynchronized());
+
+ // methodNode9 -- we check one thrown exception
+ methodNode = findByMethodName("method9", testMethods);
+ assertEquals(methodNode.getException().size(), 1);
+
+ TypeInfo exception = methodNode.getException().get(0);
+ assertEquals(exception.getQualified(), "java.lang.Exception");
+ assertEquals(exception.getDimension(), null);
+ assertEquals(exception.getGeneric().size(), 0);
+ assertNull(exception.getWildcard());
+
+ // methodNode10 -- we check two thrown exceptions
+ methodNode = findByMethodName("method10", testMethods);
+ assertEquals(methodNode.getException().size(), 2);
+
+ exception = methodNode.getException().get(0);
+ assertEquals(exception.getQualified(), "java.lang.OutOfMemoryError");
+ assertEquals(exception.getDimension(), null);
+ assertEquals(exception.getGeneric().size(), 0);
+
+ exception = methodNode.getException().get(1);
+ assertEquals(exception.getQualified(), "java.lang.IllegalArgumentException");
+ assertEquals(exception.getDimension(), null);
+ assertEquals(exception.getGeneric().size(), 0);
+
+ // negative--no exceptions
+ assertEquals(findByMethodName("method4", testMethods).getException().size(), 0);
+
+ // methodNode11 -- 1 annotation instance
+
+ methodNode = findByMethodName("method11", testMethods);
+ assertEquals(methodNode.getAnnotation().size(), 1);
+
+ AnnotationInstance annotation = methodNode.getAnnotation().get(0);
+ assertEquals(annotation.getQualified(), "java.lang.Deprecated");
+ assertEquals(annotation.getArgument().size(), 0);
+
+ // methodNode12 -- 2 annotation instances
+ methodNode = findByMethodName("method12", testMethods);
+ assertEquals(methodNode.getAnnotation().size(), 2);
+
+ annotation = methodNode.getAnnotation().get(0);
+ assertEquals(annotation.getQualified(), "java.lang.Deprecated");
+
+ annotation = methodNode.getAnnotation().get(1);
+ assertEquals(annotation.getQualified(), Annotation12.class.getName());
+ assertEquals(annotation.getArgument().size(), 1);
+ AnnotationArgument annotArgument = annotation.getArgument().get(0);
+ assertEquals(annotArgument.getName(), "value");
+ assertEquals(annotArgument.getValue().get(0), "java.lang.Warning");
+
+ // negative -- no annotations
+ assertEquals(findByMethodName("method4", testMethods).getAnnotation().size(), 0);
+
+ }
+
+ /**
+ * Short way of finding methodNodes. It's meant to only be used for methodNodes that do not
+ * share the same name in the same class. In fact, this class will junit assert that there is
+ * only 1 methodNode matching this name in the supplied list
+ * methodParameterNodeeter.
+ *
+ * @param methodNodeName the shortname of the methodNode
+ * @param methodNodes the list of methodNodes to look through.
+ * @return The matching methodNode
+ */
+ private Method findByMethodName(String methodNodeName, List methodNodes) {
+ for (Method methodNode : methodNodes) {
+ if (methodNode.getName().equals(methodNodeName)) {
+ return methodNode;
+ }
+ }
+
+ fail();
+ return null;
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/PrimitiveTest.java b/src/test/java/com/github/markusbernhardt/xmldoclet/PrimitiveTest.java
index 85ae7a2..c7886ad 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/PrimitiveTest.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/PrimitiveTest.java
@@ -7,12 +7,12 @@
*/
public class PrimitiveTest extends AbstractTestParent {
- /**
- * Rigourous Parser :-)
- */
- @Test
- public void test() {
- executeJavadoc(null, new String[] { "./src/test/java" }, null, null, new String[] { "com" },
- new String[] { "-dryrun" });
- }
+ /**
+ * Rigourous Parser :-)
+ */
+ @Test
+ public void test() {
+ executeJavadoc(null, new String[] {"./src/test/java"}, null, null, new String[] {"com"},
+ new String[] {"-dryrun"});
+ }
}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/TagTest.java b/src/test/java/com/github/markusbernhardt/xmldoclet/TagTest.java
index 918c002..80eb506 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/TagTest.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/TagTest.java
@@ -1,40 +1,42 @@
-package com.github.markusbernhardt.xmldoclet;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import org.junit.Test;
-
-import com.github.markusbernhardt.xmldoclet.xjc.Class;
-import com.github.markusbernhardt.xmldoclet.xjc.Package;
-import com.github.markusbernhardt.xmldoclet.xjc.Root;
-
-/**
- * Unit test group for Tags
- */
-public class TagTest extends AbstractTestParent {
-
- /**
- * testing a simple tags
- */
- @Test
- public void testTag1() {
- String[] sourceFiles = new String[] { "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Tag1.java" };
- Root rootNode = executeJavadoc(null, null, null, sourceFiles, null, new String[] { "-dryrun" });
-
- Package packageNode = rootNode.getPackage().get(0);
- Class classNode = packageNode.getClazz().get(0);
-
- assertEquals(rootNode.getPackage().size(), 1);
- assertNull(packageNode.getComment());
- assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
- assertEquals(packageNode.getAnnotation().size(), 0);
- assertEquals(packageNode.getEnum().size(), 0);
- assertEquals(packageNode.getInterface().size(), 0);
- assertEquals(packageNode.getClazz().size(), 1);
-
- assertEquals(classNode.getTag().size(), 7);
- assertEquals(classNode.getMethod().get(0).getTag().size(), 3);
- }
-
-}
+package com.github.markusbernhardt.xmldoclet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+import com.github.markusbernhardt.xmldoclet.xjc.Class;
+import com.github.markusbernhardt.xmldoclet.xjc.Package;
+import com.github.markusbernhardt.xmldoclet.xjc.Root;
+
+/**
+ * Unit test group for Tags
+ */
+public class TagTest extends AbstractTestParent {
+
+ /**
+ * testing a simple tags
+ */
+ @Test
+ public void testTag1() {
+ String[] sourceFiles = new String[] {
+ "./src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Tag1.java"};
+ Root rootNode =
+ executeJavadoc(null, null, null, sourceFiles, null, new String[] {"-dryrun"});
+
+ Package packageNode = rootNode.getPackage().get(0);
+ Class classNode = packageNode.getClazz().get(0);
+
+ assertEquals(rootNode.getPackage().size(), 1);
+ assertNull(packageNode.getComment());
+ assertEquals(packageNode.getName(), "com.github.markusbernhardt.xmldoclet.simpledata");
+ assertEquals(packageNode.getAnnotation().size(), 0);
+ assertEquals(packageNode.getEnum().size(), 0);
+ assertEquals(packageNode.getInterface().size(), 0);
+ assertEquals(packageNode.getClazz().size(), 1);
+
+ assertEquals(classNode.getTag().size(), 7);
+ assertEquals(classNode.getMethod().get(0).getTag().size(), 3);
+ }
+
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation10.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation10.java
index 2c4dfcb..35c6e1d 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation10.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation10.java
@@ -4,10 +4,10 @@
* Annotation10
*/
@interface Annotation10 {
- /**
- * id
- *
- * @return ret
- */
- public abstract char id();
-}
\ No newline at end of file
+ /**
+ * id
+ *
+ * @return ret
+ */
+ public abstract char id();
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation11.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation11.java
index 3510061..e4078e7 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation11.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation11.java
@@ -4,10 +4,10 @@
* Annotation11
*/
@interface Annotation11 {
- /**
- * id
- *
- * @return ret
- */
- public abstract boolean id();
-}
\ No newline at end of file
+ /**
+ * id
+ *
+ * @return ret
+ */
+ public abstract boolean id();
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation12.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation12.java
index fdeaa2e..a71b600 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation12.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation12.java
@@ -4,10 +4,10 @@
* Annotation12
*/
public @interface Annotation12 {
- /**
- * value
- *
- * @return ret
- */
- String[] value();
-}
\ No newline at end of file
+ /**
+ * value
+ *
+ * @return ret
+ */
+ String[] value();
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation2.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation2.java
index 7795e7f..89f4c8c 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation2.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation2.java
@@ -5,4 +5,4 @@
*/
@Deprecated
public @interface Annotation2 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation3.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation3.java
index aa1feff..7a5ca61 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation3.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation3.java
@@ -4,10 +4,10 @@
* Annotation3
*/
public @interface Annotation3 {
- /**
- * id
- *
- * @return ret
- */
- public int id() default 3;
-}
\ No newline at end of file
+ /**
+ * id
+ *
+ * @return ret
+ */
+ public int id() default 3;
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation4.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation4.java
index 7e1257b..2537432 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation4.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation4.java
@@ -4,4 +4,4 @@
* Annotation4
*/
@interface Annotation4 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation5.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation5.java
index aa45f83..6388563 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation5.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation5.java
@@ -4,10 +4,10 @@
* Annotation5
*/
@interface Annotation5 {
- /**
- * id
- *
- * @return ret
- */
- public int[] id() default { 2, 3 };
-}
\ No newline at end of file
+ /**
+ * id
+ *
+ * @return ret
+ */
+ public int[] id() default {2, 3};
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation6.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation6.java
index ac0d0b9..91ca028 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation6.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation6.java
@@ -4,10 +4,10 @@
* Annotation6
*/
@interface Annotation6 {
- /**
- * id
- *
- * @return ret
- */
- public abstract String id() default "hello";
-}
\ No newline at end of file
+ /**
+ * id
+ *
+ * @return ret
+ */
+ public abstract String id() default "hello";
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation7.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation7.java
index f89346e..ff148aa 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation7.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation7.java
@@ -4,10 +4,10 @@
* Annotation7
*/
@interface Annotation7 {
- /**
- * id
- *
- * @return ret
- */
- public abstract Enum1 id() default Enum1.b;
-}
\ No newline at end of file
+ /**
+ * id
+ *
+ * @return ret
+ */
+ public abstract Enum1 id() default Enum1.b;
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation8.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation8.java
index 09442ed..a428c35 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation8.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation8.java
@@ -4,11 +4,11 @@
* Annotation8
*/
@interface Annotation8 {
- /**
- * id
- *
- * @return ret
- */
- @SuppressWarnings("rawtypes")
- public abstract Class id() default Object.class;
-}
\ No newline at end of file
+ /**
+ * id
+ *
+ * @return ret
+ */
+ @SuppressWarnings("rawtypes")
+ public abstract Class id() default Object.class;
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation9.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation9.java
index 5d458bd..19a5bed 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation9.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Annotation9.java
@@ -4,10 +4,10 @@
* Annotation9
*/
@interface Annotation9 {
- /**
- * id
- *
- * @return ret
- */
- public abstract Class id();
-}
\ No newline at end of file
+ /**
+ * id
+ *
+ * @return ret
+ */
+ public abstract Class id();
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/AnnotationCascade.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/AnnotationCascade.java
index 9f83118..534c559 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/AnnotationCascade.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/AnnotationCascade.java
@@ -4,10 +4,10 @@
* AnnotationCascade
*/
public @interface AnnotationCascade {
- /**
- * value
- *
- * @return ret
- */
- AnnotationCascadeChild[] children();
-}
\ No newline at end of file
+ /**
+ * value
+ *
+ * @return ret
+ */
+ AnnotationCascadeChild[] children();
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/AnnotationCascadeChild.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/AnnotationCascadeChild.java
index b1c2a28..963bff7 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/AnnotationCascadeChild.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/AnnotationCascadeChild.java
@@ -1,18 +1,19 @@
-package com.github.markusbernhardt.xmldoclet.simpledata;
-
-/**
- * AnnotationCascadeChild
- */
-public @interface AnnotationCascadeChild {
-
- /**
- * The name.
- * @return The name.
- */
- public String name();
-
- public String[] dummyData() default {} ;
-
- public Annotation3[] subAnnotations() default {};
-
-}
+package com.github.markusbernhardt.xmldoclet.simpledata;
+
+/**
+ * AnnotationCascadeChild
+ */
+public @interface AnnotationCascadeChild {
+
+ /**
+ * The name.
+ *
+ * @return The name.
+ */
+ public String name();
+
+ public String[] dummyData() default {};
+
+ public Annotation3[] subAnnotations() default {};
+
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class10.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class10.java
index 8c0b15c..25cba13 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class10.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class10.java
@@ -5,4 +5,4 @@
*/
class Class10 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class11.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class11.java
index 43d798a..924eac0 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class11.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class11.java
@@ -6,4 +6,4 @@
@SuppressWarnings("serial")
public class Class11 extends java.lang.Exception {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class12.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class12.java
index 7e37c03..5688afd 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class12.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class12.java
@@ -6,4 +6,4 @@
@SuppressWarnings("serial")
public class Class12 extends java.lang.Error {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class13.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class13.java
index cb5b30d..0aa5dd6 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class13.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class13.java
@@ -3,8 +3,7 @@
/**
* Class13
*
- * @param
- * Generic class
+ * @param Generic class
*/
public class Class13 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class14.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class14.java
index f560240..cbbfafb 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class14.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class14.java
@@ -3,8 +3,7 @@
/**
* Class14
*
- * @param
- * Generic class
+ * @param Generic class
*/
public class Class14 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class15.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class15.java
index 5568e6e..9c16d41 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class15.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class15.java
@@ -3,8 +3,7 @@
/**
* Class15
*
- * @param
- * Generic class
+ * @param Generic class
*/
public class Class15 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class16.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class16.java
index 1956a47..93bcae8 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class16.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class16.java
@@ -6,4 +6,4 @@
@Annotation3(id = 3)
public class Class16 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class17.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class17.java
index 7a56ece..8eaf0af 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class17.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class17.java
@@ -3,7 +3,7 @@
/**
* Class17
*/
-@Annotation5(id = { 1, 2 })
+@Annotation5(id = {1, 2})
public class Class17 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class18.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class18.java
index ea768cc..7d1a243 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class18.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class18.java
@@ -6,4 +6,4 @@
@Annotation6(id = "hey")
public class Class18 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class19.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class19.java
index 019d135..2f7c17c 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class19.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class19.java
@@ -6,4 +6,4 @@
@Annotation7(id = Enum1.a)
public class Class19 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class2.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class2.java
index fd024db..839a911 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class2.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class2.java
@@ -4,10 +4,10 @@
* Class2
*/
public class Class2 {
- /**
- * Constructor1
- */
- public Class2() {
+ /**
+ * Constructor1
+ */
+ public Class2() {
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class20.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class20.java
index 7f4188e..f295d70 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class20.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class20.java
@@ -6,4 +6,4 @@
@Annotation8(id = String.class)
public class Class20 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class21.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class21.java
index 4cf4c84..4794dbb 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class21.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class21.java
@@ -6,4 +6,4 @@
@Annotation10(id = 'a')
public class Class21 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class22.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class22.java
index 95035b7..b178197 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class22.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class22.java
@@ -6,4 +6,4 @@
@Annotation10(id = '\u0000')
public class Class22 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class23.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class23.java
index db2805a..d6627f6 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class23.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class23.java
@@ -6,4 +6,4 @@
@Annotation11(id = true)
public class Class23 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class24.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class24.java
index 76d4715..d2ab637 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class24.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class24.java
@@ -6,4 +6,4 @@
@Annotation5(id = {})
public class Class24 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class3.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class3.java
index fde8ad7..7861e6f 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class3.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class3.java
@@ -4,12 +4,12 @@
* Class3
*/
public class Class3 {
- /**
- * method1
- *
- * @return int
- */
- public int method1() {
- return 0;
- }
-}
\ No newline at end of file
+ /**
+ * method1
+ *
+ * @return int
+ */
+ public int method1() {
+ return 0;
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class4.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class4.java
index 777e168..8df1472 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class4.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class4.java
@@ -4,8 +4,8 @@
* Class4
*/
public class Class4 {
- /**
- * field1
- */
- public int field1;
-}
\ No newline at end of file
+ /**
+ * field1
+ */
+ public int field1;
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class5.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class5.java
index da22642..dfa69eb 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class5.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class5.java
@@ -5,4 +5,4 @@
*/
public class Class5 extends Class3 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class6.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class6.java
index 348c7eb..f2994be 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class6.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class6.java
@@ -6,4 +6,4 @@
@SuppressWarnings("serial")
public class Class6 implements java.io.Serializable {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class7.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class7.java
index 7a24c0c..e4a31a8 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class7.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class7.java
@@ -6,4 +6,4 @@
@Deprecated
public class Class7 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class8.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class8.java
index 8182db2..17a5acd 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class8.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class8.java
@@ -5,4 +5,4 @@
*/
public abstract class Class8 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class9.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class9.java
index 8e25486..86411da 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class9.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Class9.java
@@ -9,13 +9,13 @@
*/
public class Class9 implements java.io.Externalizable {
- public void writeExternal(ObjectOutput out) throws IOException {
- // To change body of implemented methods use File | Settings | File
- // Templates.
- }
+ public void writeExternal(ObjectOutput out) throws IOException {
+ // To change body of implemented methods use File | Settings | File
+ // Templates.
+ }
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- // To change body of implemented methods use File | Settings | File
- // Templates.
- }
-}
\ No newline at end of file
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ // To change body of implemented methods use File | Settings | File
+ // Templates.
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/ClassAnnotationCascade.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/ClassAnnotationCascade.java
index c7dc0e7..b09f6e0 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/ClassAnnotationCascade.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/ClassAnnotationCascade.java
@@ -1,33 +1,31 @@
-package com.github.markusbernhardt.xmldoclet.simpledata;
-
-/**
- * ClassAnnotationCascade
- */
-@AnnotationCascade(
- children= {
- @AnnotationCascadeChild(name="primitive",
- dummyData= {"A", "B", "C"}
- ),
- @AnnotationCascadeChild(name="nested",
- subAnnotations= {
- @Annotation3(id=4),
- @Annotation3(id=5),
- @Annotation3(id=666)
-
- })
- }
- )
-public class ClassAnnotationCascade implements Interface2 {
-
- public void test() {
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int method1() {
- return 0;
- }
-}
+package com.github.markusbernhardt.xmldoclet.simpledata;
+
+/**
+ * ClassAnnotationCascade
+ */
+@AnnotationCascade(
+ children = {
+ @AnnotationCascadeChild(name = "primitive",
+ dummyData = {"A", "B", "C"}),
+ @AnnotationCascadeChild(name = "nested",
+ subAnnotations = {
+ @Annotation3(id = 4),
+ @Annotation3(id = 5),
+ @Annotation3(id = 666)
+
+ })
+ })
+public class ClassAnnotationCascade implements Interface2 {
+
+ public void test() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int method1() {
+ return 0;
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum1.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum1.java
index 99892d5..9d397d2 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum1.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum1.java
@@ -4,16 +4,16 @@
* Enum1
*/
public enum Enum1 {
- /**
- * a
- */
- a,
- /**
- * b
- */
- b,
- /**
- * c
- */
- c
-}
\ No newline at end of file
+ /**
+ * a
+ */
+ a,
+ /**
+ * b
+ */
+ b,
+ /**
+ * c
+ */
+ c
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum2.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum2.java
index 2ee7642..b2c4cd8 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum2.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum2.java
@@ -4,4 +4,4 @@
* Enum2
*/
public enum Enum2 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum3.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum3.java
index f82bec2..66d082f 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum3.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum3.java
@@ -4,4 +4,4 @@
* Enum3
*/
public enum Enum3 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum4.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum4.java
index 5a7903e..a91dfc2 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum4.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum4.java
@@ -4,6 +4,6 @@
* Enum4
*/
public enum Enum4 {
- /** field1 */
- field
-}
\ No newline at end of file
+ /** field1 */
+ field
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum5.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum5.java
index 4567667..7a7ba90 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum5.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum5.java
@@ -5,4 +5,4 @@
*/
@Deprecated
public enum Enum5 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum6.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum6.java
index 8449ae8..c061dbc 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum6.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Enum6.java
@@ -6,4 +6,4 @@
@Deprecated
@Annotation12("mister")
public enum Enum6 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Field1.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Field1.java
index 1583f90..207322f 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Field1.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Field1.java
@@ -7,59 +7,59 @@
* Field1
*/
public class Field1 {
- /** field */
- public String field0;
+ /** field */
+ public String field0;
- /** field */
- public String field1;
+ /** field */
+ public String field1;
- /** field */
- @SuppressWarnings("unused")
- private String field2;
+ /** field */
+ @SuppressWarnings("unused")
+ private String field2;
- /** field */
- String field3;
+ /** field */
+ String field3;
- /** field */
- protected String field4;
+ /** field */
+ protected String field4;
- /** field */
- public volatile String field5;
+ /** field */
+ public volatile String field5;
- /** field */
- public static String field6;
+ /** field */
+ public static String field6;
- /** field */
- public transient String field7;
+ /** field */
+ public transient String field7;
- /** field */
- public final String field8 = "mer";
+ /** field */
+ public final String field8 = "mer";
- /** field */
- public final String field9 = "testy";
+ /** field */
+ public final String field9 = "testy";
- /** field */
- public final int field10 = 10;
+ /** field */
+ public final int field10 = 10;
- /** field */
- @Deprecated
- public String field11;
+ /** field */
+ @Deprecated
+ public String field11;
- /** field */
- @Deprecated
- @Annotation12("mister")
- public String field12;
+ /** field */
+ @Deprecated
+ @Annotation12("mister")
+ public String field12;
- /** field */
- public String field13;
+ /** field */
+ public String field13;
- /** field */
- public ArrayList> field14;
+ /** field */
+ public ArrayList> field14;
- /** field */
- public HashMap field15;
+ /** field */
+ public HashMap field15;
- /** field */
- public String[] field16;
+ /** field */
+ public String[] field16;
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface1.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface1.java
index 677a3fb..47d9194 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface1.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface1.java
@@ -5,4 +5,4 @@
*/
public interface Interface1 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface2.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface2.java
index 873197b..ff285c4 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface2.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface2.java
@@ -4,10 +4,10 @@
* Interface2
*/
public interface Interface2 {
- /**
- * method1
- *
- * @return int
- */
- public int method1();
-}
\ No newline at end of file
+ /**
+ * method1
+ *
+ * @return int
+ */
+ public int method1();
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface3.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface3.java
index 485b47e..6123bf9 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface3.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface3.java
@@ -4,4 +4,4 @@
* Interface3
*/
public interface Interface3 extends java.io.Serializable {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface4.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface4.java
index 2b71554..804e6dd 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface4.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface4.java
@@ -5,4 +5,4 @@
*/
@Deprecated
public interface Interface4 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface5.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface5.java
index 7f978f1..924daf2 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface5.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface5.java
@@ -4,8 +4,8 @@
* Interface5
*/
interface Interface5 {
- /**
- * method1
- */
- void method1();
+ /**
+ * method1
+ */
+ void method1();
}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface6.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface6.java
index 5960c1c..a20aa2e 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface6.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface6.java
@@ -3,8 +3,7 @@
/**
* Interface6
*
- * @param
- * Generic Class
+ * @param Generic Class
*/
public interface Interface6 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface7.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface7.java
index 8569838..c49b7a0 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface7.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface7.java
@@ -3,8 +3,7 @@
/**
* Interface7
*
- * @param
- * Generic Class
+ * @param Generic Class
*/
public interface Interface7 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface8.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface8.java
index da312ba..67970ea 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface8.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Interface8.java
@@ -3,8 +3,7 @@
/**
* Interface8
*
- * @param
- * Generic Class
+ * @param Generic Class
*/
public interface Interface8 {
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method1.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method1.java
index c64d7e1..95ef78c 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method1.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method1.java
@@ -4,78 +4,78 @@
* Class1
*/
public class Method1 {
- /** Method */
- public void method1() {
+ /** Method */
+ public void method1() {
- }
+ }
- /**
- * Method
- *
- * @return ret
- */
- public Integer method2() {
- return new Integer(0);
- }
+ /**
+ * Method
+ *
+ * @return ret
+ */
+ public Integer method2() {
+ return new Integer(0);
+ }
- /**
- * Method
- *
- * @return ret
- */
- public int method3() {
- return 0;
- }
+ /**
+ * Method
+ *
+ * @return ret
+ */
+ public int method3() {
+ return 0;
+ }
- /** Method */
- public void method4() {
+ /** Method */
+ public void method4() {
- }
+ }
- /**
+ /**
*
*/
- public void method5() {
+ public void method5() {
- }
+ }
- /**
- *
- * @return lins
- */
- public Integer method6() {
- return new Integer(0);
- }
+ /**
+ *
+ * @return lins
+ */
+ public Integer method6() {
+ return new Integer(0);
+ }
- /**
- *
- * @return line
- */
- public Integer method7() {
- return new Integer(0);
- }
+ /**
+ *
+ * @return line
+ */
+ public Integer method7() {
+ return new Integer(0);
+ }
- /**
- *
- * @return line
- */
- public Integer method8() {
- return new Integer(0);
- }
+ /**
+ *
+ * @return line
+ */
+ public Integer method8() {
+ return new Integer(0);
+ }
- /**
- *
- * @return line line
- */
- public Integer method9() {
- return new Integer(0);
- }
+ /**
+ *
+ * @return line line
+ */
+ public Integer method9() {
+ return new Integer(0);
+ }
- /**
- *
- * @return line line
- */
- public Integer method10() {
- return new Integer(0);
- }
-}
\ No newline at end of file
+ /**
+ *
+ * @return line line
+ */
+ public Integer method10() {
+ return new Integer(0);
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method2.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method2.java
index 5f45708..86adcbd 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method2.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method2.java
@@ -6,100 +6,90 @@
* Class1
*/
public class Method2 {
- /** Method */
- public void method1() {
-
- }
-
- /**
- * Method
- *
- * @param arg1
- * arg
- */
- public void method2(Integer arg1) {
-
- }
-
- /**
- * Method
- *
- * @param arg1
- * arg
- */
- public void method3(int arg1) {
-
- }
-
- /**
- * Method
- *
- * @param arg1
- * arg
- * @param arg2
- * arg
- */
- public void method4(Integer arg1, Integer arg2) {
-
- }
-
- /**
- * Method
- *
- * @param arg1
- * arg
- */
- public void method5(ArrayList arg1) {
-
- }
-
- /**
- * Method
- *
- * @param arg1
- * arg
- */
- public void method6(ArrayList> arg1) {
-
- }
-
- /**
- * Method
- *
- * @param arg1
- * arg
- */
- public void method7(ArrayList extends String> arg1) {
-
- }
-
- /**
- * Method
- *
- * @param arg1
- * arg
- */
- public void method8(ArrayList super String> arg1) {
-
- }
-
- /**
- * Method
- *
- * @param arg1
- * arg
- */
- public void method9(ArrayList> arg1) {
-
- }
-
- /**
- * Method
- *
- * @param object
- * object
- */
- public void method10(Object... object) {
-
- }
-}
\ No newline at end of file
+ /** Method */
+ public void method1() {
+
+ }
+
+ /**
+ * Method
+ *
+ * @param arg1 arg
+ */
+ public void method2(Integer arg1) {
+
+ }
+
+ /**
+ * Method
+ *
+ * @param arg1 arg
+ */
+ public void method3(int arg1) {
+
+ }
+
+ /**
+ * Method
+ *
+ * @param arg1 arg
+ * @param arg2 arg
+ */
+ public void method4(Integer arg1, Integer arg2) {
+
+ }
+
+ /**
+ * Method
+ *
+ * @param arg1 arg
+ */
+ public void method5(ArrayList arg1) {
+
+ }
+
+ /**
+ * Method
+ *
+ * @param arg1 arg
+ */
+ public void method6(ArrayList> arg1) {
+
+ }
+
+ /**
+ * Method
+ *
+ * @param arg1 arg
+ */
+ public void method7(ArrayList extends String> arg1) {
+
+ }
+
+ /**
+ * Method
+ *
+ * @param arg1 arg
+ */
+ public void method8(ArrayList super String> arg1) {
+
+ }
+
+ /**
+ * Method
+ *
+ * @param arg1 arg
+ */
+ public void method9(ArrayList> arg1) {
+
+ }
+
+ /**
+ * Method
+ *
+ * @param object object
+ */
+ public void method10(Object... object) {
+
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method3.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method3.java
index dc65a40..7ddc079 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method3.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Method3.java
@@ -4,76 +4,73 @@
* Class1
*/
public class Method3 {
- /** Method */
- public void method1() {
+ /** Method */
+ public void method1() {
- }
+ }
- /** Method */
- void method2() {
+ /** Method */
+ void method2() {
- }
+ }
- /** Method */
- private void method3() {
+ /** Method */
+ private void method3() {
- }
+ }
- /** Method */
- protected void method4() {
+ /** Method */
+ protected void method4() {
- }
+ }
- /** Method */
- public native void method5();
+ /** Method */
+ public native void method5();
- /** Method */
- public static void method6() {
+ /** Method */
+ public static void method6() {
- }
+ }
- /** Method */
- public final void method7() {
+ /** Method */
+ public final void method7() {
- }
+ }
- /** Method */
- public synchronized void method8() {
+ /** Method */
+ public synchronized void method8() {
- }
+ }
- /**
- * Method
- *
- * @throws Exception
- * exception
- */
- public void method9() throws Exception {
+ /**
+ * Method
+ *
+ * @throws Exception exception
+ */
+ public void method9() throws Exception {
- }
+ }
- /**
- * Method
- *
- * @throws OutOfMemoryError
- * exception
- * @throws IllegalArgumentException
- * exception
- */
- public void method10() throws OutOfMemoryError, IllegalArgumentException {
+ /**
+ * Method
+ *
+ * @throws OutOfMemoryError exception
+ * @throws IllegalArgumentException exception
+ */
+ public void method10() throws OutOfMemoryError, IllegalArgumentException {
- }
+ }
- /** Method */
- @Deprecated
- public void method11() {
+ /** Method */
+ @Deprecated
+ public void method11() {
- }
+ }
- /** Method */
- @Deprecated
- @Annotation12("java.lang.Warning")
- public void method12() {
+ /** Method */
+ @Deprecated
+ @Annotation12("java.lang.Warning")
+ public void method12() {
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Tag1.java b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Tag1.java
index 2562de1..847d74e 100644
--- a/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Tag1.java
+++ b/src/test/java/com/github/markusbernhardt/xmldoclet/simpledata/Tag1.java
@@ -1,27 +1,25 @@
-package com.github.markusbernhardt.xmldoclet.simpledata;
-
-/**
- * Tag1
- *
- * @author author
- * @deprecated deprecated
- * @category category
- * @see java.lang.Object
- * @serial serial
- * @since since
- * @version version
- */
-public class Tag1 {
- /**
- * The famous foo
method.
- *
- * @param bar
- * bar
- * @return object
- * @throws NullPointerException
- * exception
- */
- public Object foo(Object bar) {
- return "";
- }
-}
+package com.github.markusbernhardt.xmldoclet.simpledata;
+
+/**
+ * Tag1
+ *
+ * @author author
+ * @deprecated deprecated
+ * @category category
+ * @see java.lang.Object
+ * @serial serial
+ * @since since
+ * @version version
+ */
+public class Tag1 {
+ /**
+ * The famous foo
method.
+ *
+ * @param bar bar
+ * @return object
+ * @throws NullPointerException exception
+ */
+ public Object foo(Object bar) {
+ return "";
+ }
+}