Skip to content

Commit

Permalink
added some information for assertEquals
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed May 14, 2024
1 parent f168b21 commit 7736942
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class DeclarationsTest extends AbstractXtendTestCase {
assertEquals('java.lang.SuppressWarnings', supressWarningsDeclaration.qualifiedName)
assertEquals('unused', suppressWarning.getStringArrayValue('value').get(0))

assertEquals(2, supressWarningsDeclaration.annotations.size)
val annotations = supressWarningsDeclaration.annotations
assertEquals(annotations.map[it.annotationTypeDeclaration].toString,
2, annotations.size)

val valueProperty = supressWarningsDeclaration.declaredMembers.filter(typeof(AnnotationTypeElementDeclaration)).head
assertEquals("String[]", valueProperty.type.toString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Conversions;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.junit.Assert;
Expand Down Expand Up @@ -79,7 +80,12 @@ public void testAnnotation() {
final AnnotationTypeDeclaration supressWarningsDeclaration = suppressWarning.getAnnotationTypeDeclaration();
Assert.assertEquals("java.lang.SuppressWarnings", supressWarningsDeclaration.getQualifiedName());
Assert.assertEquals("unused", suppressWarning.getStringArrayValue("value")[0]);
Assert.assertEquals(2, IterableExtensions.size(supressWarningsDeclaration.getAnnotations()));
final Iterable<? extends AnnotationReference> annotations = supressWarningsDeclaration.getAnnotations();
final Function1<AnnotationReference, AnnotationTypeDeclaration> _function_1 = (AnnotationReference it_1) -> {
return it_1.getAnnotationTypeDeclaration();
};
Assert.assertEquals(IterableExtensions.map(annotations, _function_1).toString(),
2, IterableExtensions.size(annotations));
final AnnotationTypeElementDeclaration valueProperty = IterableExtensions.<AnnotationTypeElementDeclaration>head(Iterables.<AnnotationTypeElementDeclaration>filter(supressWarningsDeclaration.getDeclaredMembers(), AnnotationTypeElementDeclaration.class));
Assert.assertEquals("String[]", valueProperty.getType().toString());
Assert.assertEquals("value", valueProperty.getSimpleName());
Expand Down

0 comments on commit 7736942

Please sign in to comment.