diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/domain/KafkaDomainService.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/domain/KafkaDomainService.java index f266e0c066e..ae34cd556b6 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/domain/KafkaDomainService.java +++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/domain/KafkaDomainService.java @@ -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)); } } @@ -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)); } } diff --git a/src/test/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/application/KafkaApplicationServiceIT.java b/src/test/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/application/KafkaApplicationServiceIT.java index 43fd02f48f5..de0e4209171 100644 --- a/src/test/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/application/KafkaApplicationServiceIT.java +++ b/src/test/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/application/KafkaApplicationServiceIT.java @@ -51,10 +51,6 @@ void shouldInit() { assertFileContent(project, POM_XML, ""); assertFileContent(project, POM_XML, ""); 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 @@ -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 kafkaClients() { diff --git a/src/test/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/domain/KafkaDomainServiceTest.java b/src/test/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/domain/KafkaDomainServiceTest.java index 2f580cf0e25..c3b90211f18 100644 --- a/src/test/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/domain/KafkaDomainServiceTest.java +++ b/src/test/java/tech/jhipster/lite/generator/server/springboot/broker/kafka/domain/KafkaDomainServiceTest.java @@ -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()); @@ -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