Skip to content

Commit 0fcae56

Browse files
author
Tomasz Lelek
committed
BAEL-602 use Stream.of
1 parent 08ced40 commit 0fcae56

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎jooq/src/test/java/com/baeldung/JOOLTest.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public void givenSeq_whenCheckContains_shouldReturnTrue() {
3636
@Test
3737
public void givenStreams_whenJoin_shouldHaveElementsFromTwoStreams() {
3838
//given
39-
Stream<Integer> left = Arrays.asList(1, 2, 4).stream();
40-
Stream<Integer> right = Arrays.asList(1, 2, 3).stream();
39+
Stream<Integer> left = Stream.of(1, 2, 4);
40+
Stream<Integer> right = Stream.of(1, 2, 3);
4141

4242
//when
4343
List<Integer> rightCollected = right.collect(Collectors.toList());
@@ -172,7 +172,7 @@ public Integer methodThatThrowsChecked(String arg) throws Exception {
172172
@Test
173173
public void givenOperationThatThrowsCheckedException_whenExecuteAndNeedToWrapCheckedIntoUnchecked_shouldPass() {
174174
//when
175-
List<Integer> collect = Arrays.asList("a", "b", "c").stream().map(elem -> {
175+
List<Integer> collect = Stream.of("a", "b", "c").map(elem -> {
176176
try {
177177
return methodThatThrowsChecked(elem);
178178
} catch (Exception e) {
@@ -192,7 +192,7 @@ public void givenOperationThatThrowsCheckedException_whenExecuteAndNeedToWrapChe
192192
@Test
193193
public void givenOperationThatThrowsCheckedException_whenExecuteUsingUncheckedFuction_shouldPass() {
194194
//when
195-
List<Integer> collect = Arrays.asList("a", "b", "c").stream()
195+
List<Integer> collect = Stream.of("a", "b", "c")
196196
.map(Unchecked.function(elem -> methodThatThrowsChecked(elem)))
197197
.collect(Collectors.toList());
198198

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<module>jaxb</module>
6666
<module>jee7</module>
6767
<module>jjwt</module>
68+
<module>jooq</module>
6869
<module>jpa-storedprocedure</module>
6970
<module>jsf</module>
7071
<module>json-path</module>
@@ -193,7 +194,6 @@
193194

194195
<module>struts2</module>
195196
<module>apache-velocity</module>
196-
<module>jooq</module>
197197

198198

199199
</modules>

0 commit comments

Comments
 (0)