From 286c25555a71fb888c7fe1e4a3f18a18152ead53 Mon Sep 17 00:00:00 2001 From: pivovarit Date: Tue, 16 May 2017 09:12:29 +0300 Subject: [PATCH] SplitUnitTest refactor --- .../src/test/java/com/baeldung/string/SplitUnitTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/string/SplitUnitTest.java b/core-java/src/test/java/com/baeldung/string/SplitUnitTest.java index 335ae51148..2a3df4c44f 100644 --- a/core-java/src/test/java/com/baeldung/string/SplitUnitTest.java +++ b/core-java/src/test/java/com/baeldung/string/SplitUnitTest.java @@ -2,11 +2,10 @@ package com.baeldung.string; import com.google.common.base.Splitter; import org.apache.commons.lang.StringUtils; +import org.assertj.core.util.Lists; import org.junit.Test; import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; import static org.assertj.core.api.Assertions.assertThat; @@ -51,7 +50,7 @@ public class SplitUnitTest { public void givenString_whenSplit_thenReturnsIterable_Splitter() { //given Iterable result = Splitter.on(',').trimResults().omitEmptyStrings().split("car,jeep,, scooter"); - List resultList = StreamSupport.stream(result.spliterator(), false).collect(Collectors.toList()); + List resultList = Lists.newArrayList(result); assertThat(resultList) .containsExactly("car", "jeep", "scooter");