BAEL-583 - minor changes

This commit is contained in:
slavisa-baeldung 2017-01-21 08:06:30 +01:00
parent 444c475d7c
commit 62c59c82ce
1 changed files with 7 additions and 7 deletions

View File

@ -17,7 +17,7 @@ public class Java8FindAnyFindFirstTest {
@Test
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();
@ -26,26 +26,26 @@ public class Java8FindAnyFindFirstTest {
}
@Test
public void createParallelStream_whenFindAnyResultIsPresent_ThenCorrect() throws Exception {
List<Integer> list = Arrays.asList(1,2,3,4,5);
public void createParallelStream_whenFindAnyResultIsPresent_thenCorrect() throws Exception {
List<Integer> list = Arrays.asList(1, 2, 3, 4, 5);
Optional<Integer> result = list
.stream()
.parallel()
.filter(num -> num<4)
.filter(num -> num < 4)
.findAny();
assertTrue(result.isPresent());
assertThat(result.get(),anyOf(is(1), is(2), is(3)));
assertThat(result.get(), anyOf(is(1), is(2), is(3)));
}
@Test
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();
assertTrue(result.isPresent());
assertThat(result.get(),is("A"));
assertThat(result.get(), is("A"));
}
}