BAEL-583 - minor changes
This commit is contained in:
parent
444c475d7c
commit
62c59c82ce
|
@ -17,7 +17,7 @@ public class Java8FindAnyFindFirstTest {
|
||||||
@Test
|
@Test
|
||||||
public void createStream_whenFindAnyResultIsPresent_thenCorrect() {
|
public void createStream_whenFindAnyResultIsPresent_thenCorrect() {
|
||||||
|
|
||||||
List<String> list = Arrays.asList("A","B","C","D");
|
List<String> list = Arrays.asList("A", "B", "C", "D");
|
||||||
|
|
||||||
Optional<String> result = list.stream().findAny();
|
Optional<String> result = list.stream().findAny();
|
||||||
|
|
||||||
|
@ -26,26 +26,26 @@ public class Java8FindAnyFindFirstTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createParallelStream_whenFindAnyResultIsPresent_ThenCorrect() throws Exception {
|
public void createParallelStream_whenFindAnyResultIsPresent_thenCorrect() throws Exception {
|
||||||
List<Integer> list = Arrays.asList(1,2,3,4,5);
|
List<Integer> list = Arrays.asList(1, 2, 3, 4, 5);
|
||||||
Optional<Integer> result = list
|
Optional<Integer> result = list
|
||||||
.stream()
|
.stream()
|
||||||
.parallel()
|
.parallel()
|
||||||
.filter(num -> num<4)
|
.filter(num -> num < 4)
|
||||||
.findAny();
|
.findAny();
|
||||||
|
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
assertThat(result.get(),anyOf(is(1), is(2), is(3)));
|
assertThat(result.get(), anyOf(is(1), is(2), is(3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createStream_whenFindFirstResultIsPresent_thenCorrect() {
|
public void createStream_whenFindFirstResultIsPresent_thenCorrect() {
|
||||||
|
|
||||||
List<String> list = Arrays.asList("A","B","C","D");
|
List<String> list = Arrays.asList("A", "B", "C", "D");
|
||||||
|
|
||||||
Optional<String> result = list.stream().findFirst();
|
Optional<String> result = list.stream().findFirst();
|
||||||
|
|
||||||
assertTrue(result.isPresent());
|
assertTrue(result.isPresent());
|
||||||
assertThat(result.get(),is("A"));
|
assertThat(result.get(), is("A"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue