diff --git a/src/main/java/tech/jhipster/lite/generator/server/javatool/frontendmaven/domain/FrontendMavenModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/javatool/frontendmaven/domain/FrontendMavenModuleFactory.java index 326799c1049..28395700d3a 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/javatool/frontendmaven/domain/FrontendMavenModuleFactory.java +++ b/src/main/java/tech/jhipster/lite/generator/server/javatool/frontendmaven/domain/FrontendMavenModuleFactory.java @@ -38,7 +38,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) { //@formatter:off return moduleBuilder(properties) .javaDependencies() - .setVersion(javaDependencyVersion("node", "v" + npmVersions.get("node", NpmVersionSource.COMMON).get())) + .setVersion(javaDependencyVersion("node", "v" + npmVersions.getNodeVersion())) .setVersion(javaDependencyVersion("npm", npmVersions.get("npm", NpmVersionSource.COMMON).get())) .and() .mavenPlugins() diff --git a/src/test/java/tech/jhipster/lite/generator/server/javatool/frontendmaven/domain/FrontendMavenModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/javatool/frontendmaven/domain/FrontendMavenModuleFactoryTest.java index 4966ff96672..a3a20bb2ad8 100644 --- a/src/test/java/tech/jhipster/lite/generator/server/javatool/frontendmaven/domain/FrontendMavenModuleFactoryTest.java +++ b/src/test/java/tech/jhipster/lite/generator/server/javatool/frontendmaven/domain/FrontendMavenModuleFactoryTest.java @@ -37,7 +37,7 @@ void shouldBuildModule() { .build(); when(npmVersions.get("npm", NpmVersionSource.COMMON)).thenReturn(new NpmPackageVersion("4.0.0")); - when(npmVersions.get("node", NpmVersionSource.COMMON)).thenReturn(new NpmPackageVersion("16.0.0")); + when(npmVersions.getNodeVersion()).thenReturn("16.0.0"); JHipsterModule module = factory.buildModule(properties); diff --git a/src/test/java/tech/jhipster/lite/module/domain/properties/JHipsterServerPortTest.java b/src/test/java/tech/jhipster/lite/module/domain/properties/JHipsterServerPortTest.java index 969aeba0196..9a13d900b30 100644 --- a/src/test/java/tech/jhipster/lite/module/domain/properties/JHipsterServerPortTest.java +++ b/src/test/java/tech/jhipster/lite/module/domain/properties/JHipsterServerPortTest.java @@ -1,8 +1,11 @@ package tech.jhipster.lite.module.domain.properties; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import tech.jhipster.lite.UnitTest; @UnitTest @@ -18,6 +21,17 @@ void shouldGetServerPortFromPort() { assertThat(new JHipsterServerPort(9000).get()).isEqualTo(9000); } + @ParameterizedTest + @CsvSource( + { + "-90000,tech.jhipster.lite.shared.error.domain.NumberValueTooLowException", + "90000,tech.jhipster.lite.shared.error.domain.NumberValueTooHighException", + } + ) + void shouldValidatePortNumbers(int port, Class exceptionClass) { + assertThatExceptionOfType(exceptionClass).isThrownBy(() -> new JHipsterServerPort(port)); + } + @Test void testToStringShowsPortNumber() { assertThat(new JHipsterServerPort(9000)).hasToString("9000");