BAEL-583 - adding asserts to test
This commit is contained in:
parent
dabdd5d397
commit
d77ca20ff2
|
@ -1,17 +1,16 @@
|
|||
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.*;
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class Java8FindAnyFindFirstTest {
|
||||
|
||||
|
@ -22,7 +21,7 @@ public class Java8FindAnyFindFirstTest {
|
|||
|
||||
Optional<String> result = list.stream().findAny();
|
||||
|
||||
assert result.isPresent();
|
||||
assertTrue(result.isPresent());
|
||||
assertThat(result.get(), anyOf(is("A"), is("B"), is("C"), is("D")));
|
||||
}
|
||||
|
||||
|
@ -33,7 +32,7 @@ public class Java8FindAnyFindFirstTest {
|
|||
|
||||
Optional<String> result = list.stream().findFirst();
|
||||
|
||||
assert result.isPresent();
|
||||
assertTrue(result.isPresent());
|
||||
assertThat(result.get(),is("A"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue