Skip to content

Commit

Permalink
Minor - fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
ljacqu committed Jul 16, 2016
1 parent 56c87d2 commit 02bb68c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/test/java/ch/jalu/injector/utils/ReflectionUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import ch.jalu.injector.annotations.NoMethodScan;
import ch.jalu.injector.exceptions.InjectorException;
import ch.jalu.injector.exceptions.InjectorReflectionException;
import ch.jalu.injector.samples.PostConstructTestClass;
import org.hamcrest.Matcher;
import org.junit.Test;

Expand All @@ -22,10 +21,10 @@
import java.util.Set;

import static org.hamcrest.Matchers.arrayContaining;
import static org.hamcrest.Matchers.arrayWithSize;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.emptyArray;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
Expand Down Expand Up @@ -293,13 +292,15 @@ public void shouldBeWellFormedUtilsClass() {
@Test
public void shouldReturnEmptyMethodListForNoMethodScanClass() {
assertThat(ReflectionUtils.safeGetDeclaredMethods(NoMethodScanClass.class), emptyArray());
assertThat(ReflectionUtils.safeGetDeclaredMethods(PostConstructTestClass.class), arrayWithSize(3));
// Note: We need to check the size >= expected because plugins like Jacoco may add additional members
assertThat(ReflectionUtils.safeGetDeclaredMethods(ReflectionsTestClass.class).length, greaterThanOrEqualTo(4));
}

@Test
public void shouldReturnEmptyFieldListForNoFieldScanClass() {
assertThat(ReflectionUtils.safeGetDeclaredFields(NoFieldScanClass.class), emptyArray());
assertThat(ReflectionUtils.safeGetDeclaredFields(PostConstructTestClass.class), arrayWithSize(3));
// Note: We need to check the size >= expected because plugins like Jacoco may add additional members
assertThat(ReflectionUtils.safeGetDeclaredFields(ReflectionsTestClass.class).length, greaterThanOrEqualTo(4));
}

private static Field getField(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ch.jalu.injector.utils;

/**
* Test class with various fields, methods and
* Test class with various fields, methods and constructors.
*/
public class ReflectionsTestClass {

Expand Down

0 comments on commit 02bb68c

Please sign in to comment.