Refator tests
This commit is contained in:
parent
2a2d4222bb
commit
58ad03cbe1
@ -20,7 +20,6 @@ import static java.util.Arrays.stream;
|
|||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public class ProtonpackUnitTest {
|
public class ProtonpackUnitTest {
|
||||||
@Test
|
@Test
|
||||||
public void whenTakeWhile_thenTakenWhile() {
|
public void whenTakeWhile_thenTakenWhile() {
|
||||||
@ -183,14 +182,14 @@ public class ProtonpackUnitTest {
|
|||||||
public void givenProjectionFunction_whenMaxedBy_thenMaxedBy() {
|
public void givenProjectionFunction_whenMaxedBy_thenMaxedBy() {
|
||||||
Stream<String> clubs = Stream.of("Juventus", "Barcelona", "PSG");
|
Stream<String> clubs = Stream.of("Juventus", "Barcelona", "PSG");
|
||||||
Optional<String> longestName = clubs.collect(CollectorUtils.maxBy(String::length));
|
Optional<String> longestName = clubs.collect(CollectorUtils.maxBy(String::length));
|
||||||
assertThat(longestName.get()).isEqualTo("Barcelona");
|
assertThat(longestName).contains("Barcelona");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenStreamOfMultipleElem_whenUniqueCollector_thenValueReturned() {
|
public void givenStreamOfMultipleElem_whenUniqueCollector_thenValueReturned() {
|
||||||
Stream<Integer> singleElement = Stream.of(1);
|
Stream<Integer> singleElement = Stream.of(1);
|
||||||
Optional<Integer> unique = singleElement.collect(CollectorUtils.unique());
|
Optional<Integer> unique = singleElement.collect(CollectorUtils.unique());
|
||||||
assertThat(unique.get()).isEqualTo(1);
|
assertThat(unique).contains(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user