Skip to content

Commit

Permalink
Merge pull request #51 from gastaldi/master
Browse files Browse the repository at this point in the history
chore: better assertion messages
  • Loading branch information
n1hility committed Feb 22, 2019
2 parents f780071 + 8a95123 commit 61d1115
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/test/java/org/jboss/jandex/test/BasicTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@

package org.jboss.jandex.test;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
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.assertThat;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayInputStream;
Expand Down Expand Up @@ -442,11 +444,7 @@ private void verifyDummy(Index index, boolean v2features) {
private void assertHasNoArgsConstructor(Class<?> clazz, boolean result) throws IOException {
ClassInfo classInfo = getIndexForClass(clazz).getClassByName(DotName.createSimple(clazz.getName()));
assertNotNull(classInfo);
if (result) {
assertTrue(classInfo.hasNoArgsConstructor());
} else {
assertFalse(classInfo.hasNoArgsConstructor());
}
assertThat(classInfo.hasNoArgsConstructor(), is(result));
}

private void assertFlagSet(Class<?> clazz, int flag, boolean result) throws IOException {
Expand All @@ -458,7 +456,7 @@ private void assertFlagSet(Class<?> clazz, int flag, boolean result) throws IOEx
private void assertNesting(Class<?> clazz, ClassInfo.NestingType nesting, boolean result) throws IOException {
ClassInfo classInfo = getIndexForClass(clazz).getClassByName(DotName.createSimple(clazz.getName()));
assertNotNull(classInfo);
assertTrue((classInfo.nestingType() == nesting) == result);
assertThat(classInfo.nestingType(), result ? is(nesting) : not(nesting));
}

private Index getIndexForClass(Class<?> clazz) throws IOException {
Expand Down

0 comments on commit 61d1115

Please sign in to comment.