From 09a35b82ae1763aea6765272d4868752c111b969 Mon Sep 17 00:00:00 2001 From: Kanu Date: Fri, 11 Oct 2024 14:22:02 +0530 Subject: [PATCH] Replaced Mockito.mock by creating actual object Signed-off-by: Kanu --- .../generator/VertxGeneratorIsApplicableTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jkube-kit/jkube-kit-vertx/src/test/java/org/eclipse/jkube/vertx/generator/VertxGeneratorIsApplicableTest.java b/jkube-kit/jkube-kit-vertx/src/test/java/org/eclipse/jkube/vertx/generator/VertxGeneratorIsApplicableTest.java index b4a575de21..657aa5931f 100644 --- a/jkube-kit/jkube-kit-vertx/src/test/java/org/eclipse/jkube/vertx/generator/VertxGeneratorIsApplicableTest.java +++ b/jkube-kit/jkube-kit-vertx/src/test/java/org/eclipse/jkube/vertx/generator/VertxGeneratorIsApplicableTest.java @@ -21,7 +21,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.mockito.Mockito; import java.util.Collections; import java.util.List; @@ -29,7 +28,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.params.provider.Arguments.arguments; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; class VertxGeneratorIsApplicableTest { @@ -38,8 +36,10 @@ class VertxGeneratorIsApplicableTest { @BeforeEach void setUp() { - project = mock(JavaProject.class, Mockito.RETURNS_DEEP_STUBS); - context = mock(GeneratorContext.class, Mockito.RETURNS_DEEP_STUBS); + project = JavaProject.builder().build(); + context = GeneratorContext.builder() + .project(project) + .build(); when(context.getProject()).thenReturn(project); } @@ -56,8 +56,9 @@ static Stream data() { @MethodSource("data") void isApplicable(String testDescription, List pluginList, List dependencyList, boolean expectedValue) { // Given - when(project.getPlugins()).thenReturn(pluginList); - when(project.getDependencies()).thenReturn(dependencyList); + context = context.toBuilder() + .project(project.toBuilder().plugins(pluginList).dependencies(dependencyList).build()) + .build(); // When final boolean result = new VertxGenerator(context).isApplicable(Collections.emptyList()); // Then