Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More minor additions #8692

Merged
merged 4 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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