|
28 | 28 | import java.lang.reflect.UndeclaredThrowableException; |
29 | 29 | import java.util.ArrayList; |
30 | 30 | import java.util.Arrays; |
| 31 | +import java.util.Enumeration; |
31 | 32 | import java.util.Hashtable; |
32 | 33 | import java.util.Iterator; |
33 | 34 | import java.util.List; |
|
38 | 39 | import org.apache.commons.lang3.function.Failable; |
39 | 40 | import org.apache.commons.lang3.function.FailableConsumer; |
40 | 41 | import org.apache.commons.lang3.function.FailablePredicate; |
| 42 | +import org.apache.commons.lang3.stream.Streams.FailableStream; |
41 | 43 | import org.junit.jupiter.api.DynamicTest; |
42 | 44 | import org.junit.jupiter.api.Test; |
43 | 45 | import org.junit.jupiter.api.TestFactory; |
@@ -136,6 +138,13 @@ void testArrayCollectorCombiner() { |
136 | 138 | assertEquals(Arrays.asList("a", "b", "c"), Streams.toArray(String.class).combiner().apply(left, Arrays.asList("b", "c"))); |
137 | 139 | } |
138 | 140 |
|
| 141 | + @Test |
| 142 | + void testAssertNotTerminated() { |
| 143 | + final FailableStream<String> stream = Streams.failableStream("A", "B"); |
| 144 | + assertTrue(stream.allMatch(s -> s.length() == 1)); |
| 145 | + assertThrows(IllegalStateException.class, () -> stream.allMatch(null)); |
| 146 | + } |
| 147 | + |
139 | 148 | @SuppressWarnings("deprecation") |
140 | 149 | @Test |
141 | 150 | void testDeprefcatedCopnstructor() { |
@@ -233,6 +242,9 @@ void testOfEnumeration() { |
233 | 242 | assertTrue(collect.contains("One")); |
234 | 243 | assertTrue(collect.contains("Two")); |
235 | 244 | assertEquals(2, collect.size()); |
| 245 | + assertFalse(Streams.of(table.keys()).filter(String::isEmpty).findFirst().isPresent()); |
| 246 | + assertEquals(Arrays.asList("OneOne", "TwoTwo"), Streams.of(table.keys()).map(s -> s + s).collect(Collectors.toList())); |
| 247 | + assertFalse(Streams.of(new Hashtable<String, Object>().keys()).filter(String::isEmpty).findFirst().isPresent()); |
236 | 248 | } |
237 | 249 |
|
238 | 250 | @Test |
|
0 commit comments