From 351af60bcea9dd7e54abf75c3a54fc222bf5d613 Mon Sep 17 00:00:00 2001 From: Felipe Reis Date: Thu, 2 Mar 2017 18:16:06 -0300 Subject: [PATCH] refactor: Use 'of' instead of Stream 'builder' Simplify the construction of a Stream by using the 'of()' method instead of a 'builder' Resolves: BAEL-632 --- .../baeldung/mockito/java8/CustomAnswerWithLambdaUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mockito2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithLambdaUnitTest.java b/mockito2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithLambdaUnitTest.java index eebb86e239..b4e5abdc6c 100644 --- a/mockito2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithLambdaUnitTest.java +++ b/mockito2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithLambdaUnitTest.java @@ -39,7 +39,7 @@ public class CustomAnswerWithLambdaUnitTest { MockitoAnnotations.initMocks(this); when(jobService.listJobs(any(Person.class))).then((i) -> { - return ((Person) i.getArgument(0)).getName().equals("Peter") ? Stream. builder().add(new JobPosition("Teacher")).build() : Stream.empty(); + return ((Person) i.getArgument(0)).getName().equals("Peter") ? Stream.of(new JobPosition("Teacher")) : Stream.empty(); }); } }