adding asserts to test
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"));
}
}
