/** * Examples of expected values: * * @private * @alias <ident> * @class <ident> <desc> * @type <type> * @return <type> <desc> * @param <type> <name> <desc> */ private static void assertElementEquality(FakeExtDocElement expected, ExtDocElement parsed) { assertEquals(expected.getType(), parsed.getType()); switch (parsed.getType().getCategory()) { case IDENT_SIMPLE: assertTrue(parsed instanceof ExtDocIdentSimpleElement); ExtDocIdentSimpleElement identSimpleElement = (ExtDocIdentSimpleElement) parsed; assertEquals(expected.getProperty("ident"), identSimpleElement.getIdentifier()); break; case IDENT_DESCRIBED: assertTrue(parsed instanceof ExtDocIdentDescribedElement); ExtDocIdentDescribedElement identDescribedElement = (ExtDocIdentDescribedElement) parsed; assertEquals(expected.getProperty("ident"), identDescribedElement.getIdentifier()); assertEquals(expected.getProperty("desc"), identDescribedElement.getDescription()); break; case DESCRIPTION: assertTrue(parsed instanceof ExtDocDescriptionElement); ExtDocDescriptionElement descElement = (ExtDocDescriptionElement) parsed; assertEquals(expected.getProperty("desc"), descElement.getDescription()); break; case SIMPLE: assertTrue(parsed instanceof ExtDocSimpleElement); break; case UNKNOWN: assertTrue(parsed instanceof ExtDocDescriptionElement); break; case TYPE_SIMPLE: assertTrue(parsed instanceof ExtDocTypeSimpleElement); ExtDocTypeSimpleElement typeSimpleElement = (ExtDocTypeSimpleElement) parsed; assertTypesEquality(expected, typeSimpleElement); break; case TYPE_DESCRIBED: assertTrue(parsed instanceof ExtDocTypeDescribedElement); ExtDocTypeDescribedElement typeDescElement = (ExtDocTypeDescribedElement) parsed; assertEquals(expected.getProperty("desc"), typeDescElement.getTypeDescription()); assertTypesEquality(expected, typeDescElement); break; case TYPE_NAMED: assertTrue(parsed instanceof ExtDocTypeNamedElement); ExtDocTypeNamedElement typeNamedElement = (ExtDocTypeNamedElement) parsed; assertEquals(expected.getProperty("name"), typeNamedElement.getTypeName().getName()); assertEquals(expected.getProperty("desc"), typeNamedElement.getTypeDescription()); assertTypesEquality(expected, typeNamedElement); break; default: throw new AssertionError(); } }
@Override public int compare(ExtDocElement o1, ExtDocElement o2) { return o1.getType().toString().compareTo(o2.getType().toString()); }