Skip to content

Commit

Permalink
Merge branch 'main' into spring-boot-3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mraible committed Nov 20, 2023
2 parents b4a2c62 + 052bc83 commit 1292ae3
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 9 deletions.
8 changes: 4 additions & 4 deletions jhipster-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@
<couchmove.version>3.3.2</couchmove.version>
<cucumber-jvm.version>7.14.0</cucumber-jvm.version>
<commons-collections.version>4.4</commons-collections.version>
<feign-reactor-bom.version>4.0.2</feign-reactor-bom.version>
<feign-reactor-bom.version>4.0.3</feign-reactor-bom.version>
<!-- To pull in a newer version than Spring Boot with Nonnull -->
<jakarta-annotation.version>2.1.1</jakarta-annotation.version>
<junit-platform-console.version>1.9.3</junit-platform-console.version>
<logstash-logback-encoder.version>7.4</logstash-logback-encoder.version>
<lz4-java.version>1.8.0</lz4-java.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<mongock.version>5.3.4</mongock.version>
<mongock.version>5.3.5</mongock.version>
<neo4j-migrations.version>2.7.0</neo4j-migrations.version>
<redisson.version>3.24.3</redisson.version>
<snakeyaml.version>2.2</snakeyaml.version>
<spotbugs-annotations.version>4.8.0</spotbugs-annotations.version>
<spotbugs-annotations.version>4.8.1</spotbugs-annotations.version>
<spring-cloud.version>2023.0.0-RC1</spring-cloud.version>
<springdocs.version>2.2.0</springdocs.version>
<testcontainers.version>1.19.1</testcontainers.version>
<testcontainers.version>1.19.2</testcontainers.version>
<testng.version>7.8.0</testng.version>
<xmemcached.version>2.4.7</xmemcached.version>
<xmemcached-provider.version>4.1.3</xmemcached-provider.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package tech.jhipster.domain.util;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.*;
import java.util.Date;
public class JSR310DateConvertersTest {
@Test
void testLocalDateToDateConverter() {
LocalDate localDate = LocalDate.now();
Date date = JSR310DateConverters.LocalDateToDateConverter.INSTANCE.convert(localDate);

assertEquals(localDate, JSR310DateConverters.DateToLocalDateConverter.INSTANCE.convert(date));
}

@Test
void testDurationToLongConverter() {
Duration duration = Duration.ofHours(5);
Long durationInNanos = JSR310DateConverters.DurationToLongConverter.INSTANCE.convert(duration);

assertEquals(duration, JSR310DateConverters.LongToDurationConverter.INSTANCE.convert(durationInNanos));
}

@Test
void testDateToZonedDateTimeConverter() {
Date date = new Date();
ZonedDateTime zonedDateTime = JSR310DateConverters.DateToZonedDateTimeConverter.INSTANCE.convert(date);

assertEquals(date.toInstant(), JSR310DateConverters.ZonedDateTimeToDateConverter.INSTANCE.convert(zonedDateTime).toInstant());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package tech.jhipster.security.ssl;

import org.junit.jupiter.api.Test;
import tech.jhipster.security.RandomUtil;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

class RandomUtilTest {

@Test
void testGenerateRandomAlphanumericString() {
String randomAlphaString = RandomUtil.generateRandomAlphanumericString();

// Check if the generated string is not null and has the expected length
assertNotNull(randomAlphaString);
assertTrue(randomAlphaString.length() == 20);
}

@Test
void testGeneratePassword() {
String password = RandomUtil.generatePassword();

// Check if the generated password is not null and has the expected length
assertNotNull(password);
assertTrue(password.length() == 20);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package tech.jhipster.web.rest.errors;


import org.junit.jupiter.api.Test;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import tech.jhipster.web.rest.errors.ProblemDetailWithCause;

import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

class ProblemDetailWithCauseTest {

@Test
void testProblemDetailWithCauseBuilder() {
// Create a cause
ProblemDetailWithCause cause = ProblemDetailWithCause.ProblemDetailWithCauseBuilder.instance()
.withStatus(400)
.withTitle("Bad Request")
.withDetail("Invalid input")
.withType(URI.create("about:blank"))
.build();

// Create a main problem detail with a cause
ProblemDetailWithCause problemDetailWithCause = ProblemDetailWithCause.ProblemDetailWithCauseBuilder.instance()
.withStatus(500)
.withTitle("Internal Server Error")
.withDetail("Something went wrong")
.withType(URI.create("about:blank"))
.withCause(cause)
.build();

// Verify main problem detail
assertEquals(500, problemDetailWithCause.getStatus());
assertEquals("Internal Server Error", problemDetailWithCause.getTitle());
assertEquals("Something went wrong", problemDetailWithCause.getDetail());
assertEquals(URI.create("about:blank"), problemDetailWithCause.getType());
assertNotNull(problemDetailWithCause.getCause());

// Verify the cause
assertEquals(400, problemDetailWithCause.getCause().getStatus());
assertEquals("Bad Request", problemDetailWithCause.getCause().getTitle());
assertEquals("Invalid input", problemDetailWithCause.getCause().getDetail());
assertEquals(URI.create("about:blank"), problemDetailWithCause.getCause().getType());
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"devDependencies": {
"prettier": "3.0.3"
"prettier": "3.1.0"
},
"scripts": {
"prettier:check": "prettier --check .",
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
<maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>
<maven-failsafe-plugin.version>3.2.1</maven-failsafe-plugin.version>
<maven-failsafe-plugin.version>3.2.2</maven-failsafe-plugin.version>
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
<maven-javadoc-plugin.version>3.6.0</maven-javadoc-plugin.version>
<maven-javadoc-plugin.version>3.6.2</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-surefire-plugin.version>3.2.1</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.2.2</maven-surefire-plugin.version>
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
<properties-maven-plugin.version>1.2.1</properties-maven-plugin.version>
<sonar-maven-plugin.version>3.10.0.2594</sonar-maven-plugin.version>
<versions-maven-plugin.version>2.16.1</versions-maven-plugin.version>
<versions-maven-plugin.version>2.16.2</versions-maven-plugin.version>
</properties>

<scm>
Expand Down

0 comments on commit 1292ae3

Please sign in to comment.