Skip to content

Commit

Permalink
paint it green .
Browse files Browse the repository at this point in the history
  • Loading branch information
furplag committed May 15, 2018
1 parent e2d27ee commit 578820b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
branches:
only:
- master
- jdk-8

language: java

jdk:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.junit.Assert.*;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.LinkedHashMap;
import java.util.stream.Collectors;
Expand All @@ -35,7 +36,11 @@
public class SavageReflectionTest {

@Test
public void test() {
public void test() throws ReflectiveOperationException {
Constructor<?> c = SavageReflection.class.getDeclaredConstructor();
c.setAccessible(true);
assertTrue(c.newInstance() instanceof SavageReflection);

assertFalse(SavageReflection.exclusions.test(null, Reflections.getField(TheEntity.class, "thePrimitive")));
assertTrue(SavageReflection.exclusions.test(Streamr.stream(Reflections.getFields(TheEntity.class)).map(Field::getName).collect(Collectors.toSet()), Reflections.getField(TheEntity.class, "thePrimitive")));
}
Expand Down
10 changes: 9 additions & 1 deletion src/test/java/jp/furplag/sandbox/stream/StreamrTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.junit.Assert.*;

import java.lang.reflect.Constructor;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -37,7 +38,14 @@
public class StreamrTest {

@Test
public void test() {
public void test() throws ReflectiveOperationException {
Constructor<?> c = Streamr.class.getDeclaredConstructor();
c.setAccessible(true);
assertTrue(c.newInstance() instanceof Streamr);
}

@Test
public void testStream() {
assertArrayEquals(new Object[] {}, Streamr.stream((Stream<Object>) null).toArray());
assertArrayEquals(new Object[] {}, Streamr.stream((List<Object>) null).toArray());
assertArrayEquals(new Object[] {}, Streamr.stream((Set<Object>) null).toArray());
Expand Down

0 comments on commit 578820b

Please sign in to comment.