Skip to content

Commit

Permalink
test: replace mock with builder in VertxGeneratorIsApplicableTest (3602)
Browse files Browse the repository at this point in the history
Signed-off-by: Fábio Dev <fabio.dev.gomes@gmail.com>
  • Loading branch information
FabioDevGomes authored Jan 7, 2025
1 parent 5f876f6 commit e7991cb
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ class VertxGeneratorIsApplicableTest {

@BeforeEach
void setUp() {
project = mock(JavaProject.class, Mockito.RETURNS_DEEP_STUBS);
context = mock(GeneratorContext.class, Mockito.RETURNS_DEEP_STUBS);
when(context.getProject()).thenReturn(project);
project = JavaProject.builder().build();
context = GeneratorContext.builder()
.project(project)
.build();
}

static Stream<Arguments> data() {
Expand All @@ -56,8 +57,9 @@ static Stream<Arguments> data() {
@MethodSource("data")
void isApplicable(String testDescription, List<Plugin> pluginList, List<Dependency> 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
Expand Down

0 comments on commit e7991cb

Please sign in to comment.