Skip to content

Commit

Permalink
Merge pull request #1131 from pascalgrimaud/kafka-fix-dummy-consumer-it
Browse files Browse the repository at this point in the history
Kafka: fix generation of DummyProducerIT
  • Loading branch information
pascalgrimaud authored Mar 23, 2022
2 parents 271ee5e + 2b1ec95 commit cb5f884
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public void addDummyProducer(final Project project) {
);
projectRepository.template(project, SOURCE, "DummyProducer.java", getPath(MAIN_JAVA, packageNamePath, DUMMY_PRODUCER_PATH));
projectRepository.template(project, SOURCE, "DummyProducerTest.java", getPath(TEST_JAVA, packageNamePath, DUMMY_PRODUCER_PATH));
projectRepository.template(project, SOURCE, "DummyProducerIT.java", getPath(TEST_JAVA, packageNamePath, DUMMY_PRODUCER_PATH));
projectRepository.template(project, SOURCE, "KafkaConfiguration.java", getPath(MAIN_JAVA, packageNamePath, secondaryKafkaPath));
}
}
Expand Down Expand Up @@ -135,6 +136,5 @@ void addTestcontainers(final Project project) {
}
);
springBootCommonService.updateIntegrationTestAnnotation(project, "KafkaTestContainerExtension");
projectRepository.template(project, SOURCE, "DummyProducerIT.java", getPath(TEST_JAVA, packageNamePath, DUMMY_PRODUCER_PATH));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ void shouldInit() {
assertFileContent(project, POM_XML, "<testcontainers.version>");
assertFileContent(project, POM_XML, "</testcontainers.version>");
assertFileContent(project, POM_XML, testcontainers());

String dummyProducerTestPath = getPath("com/mycompany/myapp/dummy/infrastructure/secondary/kafka/producer");
assertFileExist(project, getPath(TEST_JAVA, dummyProducerTestPath, "DummyProducerIT.java"));
assertFileContent(project, getPath(TEST_JAVA, dummyProducerTestPath, "DummyProducerIT.java"), "class DummyProducerIT");
}

@Test
Expand Down Expand Up @@ -92,6 +88,9 @@ void shouldAddProducer() {
String dummyProducerTestPath = getPath("com/mycompany/myapp/dummy/infrastructure/secondary/kafka/producer");
assertFileExist(project, getPath(TEST_JAVA, dummyProducerTestPath, "DummyProducerTest.java"));
assertFileContent(project, getPath(TEST_JAVA, dummyProducerTestPath, "DummyProducerTest.java"), "class DummyProducerTest");

assertFileExist(project, getPath(TEST_JAVA, dummyProducerTestPath, "DummyProducerIT.java"));
assertFileContent(project, getPath(TEST_JAVA, dummyProducerTestPath, "DummyProducerIT.java"), "class DummyProducerIT");
}

private List<String> kafkaClients() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void shouldInit() {
verify(buildToolService, times(2)).addDependency(any(Project.class), any(Dependency.class));
verify(dockerService, times(2)).getImageNameWithVersion(anyString());
verify(projectRepository).template(any(Project.class), anyString(), anyString(), anyString(), anyString());
verify(projectRepository, times(2)).template(any(Project.class), anyString(), anyString(), anyString());
verify(projectRepository, times(1)).template(any(Project.class), anyString(), anyString(), anyString());
verify(springBootCommonService, times(9)).addProperties(any(Project.class), anyString(), any());
verify(springBootCommonService, times(9)).addPropertiesTest(any(Project.class), anyString(), any());
verify(springBootCommonService).updateIntegrationTestAnnotation(any(Project.class), anyString());
Expand All @@ -66,7 +66,7 @@ void shouldAddProducer() {

verify(springBootCommonService).addProperties(any(Project.class), anyString(), any());
verify(springBootCommonService).addPropertiesTest(any(Project.class), anyString(), any());
verify(projectRepository, times(5)).template(any(Project.class), anyString(), anyString(), anyString());
verify(projectRepository, times(6)).template(any(Project.class), anyString(), anyString(), anyString());
}

@Test
Expand Down

0 comments on commit cb5f884

Please sign in to comment.