BAEL-583: Removed print statements and added assertments to test class
This commit is contained in:
parent
016d02ab17
commit
4119fc9c23
|
@ -1,12 +1,18 @@
|
|||
package com.baeldung.java8;
|
||||
|
||||
|
||||
import org.assertj.core.condition.AnyOf;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class Java8FindAnyFindFirstTest {
|
||||
|
||||
@Test
|
||||
|
@ -16,10 +22,8 @@ public class Java8FindAnyFindFirstTest {
|
|||
|
||||
Optional<String> result = list.stream().findAny();
|
||||
|
||||
if(result.isPresent()){
|
||||
System.out.println(result.get());
|
||||
}
|
||||
|
||||
assert result.isPresent();
|
||||
assertThat(result.get(), anyOf(is("A"), is("B"), is("C"), is("D")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -29,9 +33,7 @@ public class Java8FindAnyFindFirstTest {
|
|||
|
||||
Optional<String> result = list.stream().findFirst();
|
||||
|
||||
if(result.isPresent()){
|
||||
System.out.println(result.get());
|
||||
}
|
||||
|
||||
assert result.isPresent();
|
||||
assertThat(result.get(),is("A"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue