use of spoon.test.comment.testclasses.WildComments in project spoon by INRIA.
the class CommentTest method testWildComments.
@Test
public void testWildComments() {
// contract: tests that value of comment is correct even for wild combinations of characters. See WildComments class for details
Factory f = getSpoonFactory();
CtClass<?> type = (CtClass<?>) f.Type().get(WildComments.class);
List<CtLiteral<String>> literals = (List) ((CtNewArray<?>) type.getField("comments").getDefaultExpression()).getElements();
assertTrue(literals.size() > 10);
/*
* each string literal has a comment and string value, which defines expected value of it's comment
*/
for (CtLiteral<String> literal : literals) {
assertEquals(1, literal.getComments().size());
CtComment comment = literal.getComments().get(0);
String expected = literal.getValue();
assertEquals(literal.getPosition().toString(), expected, comment.getContent());
}
}
Aggregations