-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor spring-data-jpa integration-test
This reworks the test so that Person (an Entity class) no longer uses j.u.Random directly, but delegates generation of random data to a separate class which gets runtime-initialized. Closes #16018
- Loading branch information
Showing
3 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...tion-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/DataGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.quarkus.it.spring.data.jpa; | ||
|
||
import java.time.LocalDate; | ||
import java.time.ZoneId; | ||
import java.util.Date; | ||
import java.util.Random; | ||
|
||
public class DataGenerator { | ||
|
||
public static final Random RANDOM = new Random(); | ||
|
||
public static Date randomDate() { | ||
return Date.from(LocalDate.now().minusDays(RANDOM.nextInt(3000)).atStartOfDay() | ||
.atZone(ZoneId.systemDefault()) | ||
.toInstant()); | ||
} | ||
|
||
public static int randomAge() { | ||
return RANDOM.nextInt(100); | ||
} | ||
|
||
public static boolean randomBoolean() { | ||
return RANDOM.nextBoolean(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters