Skip to content

Commit

Permalink
Merge pull request #8692 from gzsombor/cleanups
Browse files Browse the repository at this point in the history
More minor additions
  • Loading branch information
murdos authored Jan 20, 2024
2 parents 5809be8 + a0577f9 commit a17119f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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<Exception> exceptionClass) {
assertThatExceptionOfType(exceptionClass).isThrownBy(() -> new JHipsterServerPort(port));
}

@Test
void testToStringShowsPortNumber() {
assertThat(new JHipsterServerPort(9000)).hasToString("9000");
Expand Down

0 comments on commit a17119f

Please sign in to comment.