BAEL-581 - reformatting

This commit is contained in:
slavisa-baeldung 2017-01-17 11:31:13 +01:00
parent a7c1fb3b72
commit 543c6eeb29

View File

@ -18,19 +18,19 @@ public class IterableStreamConversionTest {
@Test @Test
public void givenIterable_whenConvertedToStream_thenNotNull() { public void givenIterable_whenConvertedToStream_thenNotNull() {
String[] names = { "Testing", "Iterable", "conversion", "to", "Stream" }; String[] names = {"Testing", "Iterable", "conversion", "to", "Stream"};
StreamIterable<String> iterable = new StreamIterable<>(names); StreamIterable<String> iterable = new StreamIterable<>(names);
Assert.assertNotNull(StreamSupport.stream(iterable.spliterator(), false)); Assert.assertNotNull(StreamSupport.stream(iterable.spliterator(), false));
} }
@Test @Test
public void whenConvertedToList_thenCorrect() { public void whenConvertedToList_thenCorrect() {
String[] names = { "Testing", "Iterable", "conversion", "to", "Stream" }; String[] names = {"Testing", "Iterable", "conversion", "to", "Stream"};
StreamIterable<String> iterable = new StreamIterable<>(names); StreamIterable<String> iterable = new StreamIterable<>(names);
Stream<String> convertedStream = StreamSupport.stream(iterable.spliterator(), false); Stream<String> convertedStream = StreamSupport.stream(iterable.spliterator(), false);
List<String> collected = convertedStream.map(String::toUpperCase).collect(Collectors.toList()); List<String> collected = convertedStream.map(String::toUpperCase).collect(Collectors.toList());
assertThat(collected, contains("TESTING", "ITERABLE", "CONVERSION", "TO", "STREAM")); assertThat(collected, contains("TESTING", "ITERABLE", "CONVERSION", "TO", "STREAM"));
} }
} }
class StreamIterable<T> implements Iterable<T> { class StreamIterable<T> implements Iterable<T> {