diff --git a/easy-random-bean-validation/pom.xml b/easy-random-bean-validation/pom.xml index 6d1820b10..398652a08 100644 --- a/easy-random-bean-validation/pom.xml +++ b/easy-random-bean-validation/pom.xml @@ -54,17 +54,17 @@ easy-random-randomizers - javax.validation - validation-api + jakarta.validation + jakarta.validation-api - org.hibernate + org.hibernate.validator hibernate-validator test org.glassfish - javax.el + jakarta.el test diff --git a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/BeanValidationRandomizerRegistry.java b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/BeanValidationRandomizerRegistry.java index 90772fdc2..aa83979a5 100644 --- a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/BeanValidationRandomizerRegistry.java +++ b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/BeanValidationRandomizerRegistry.java @@ -29,7 +29,7 @@ import org.jeasy.random.api.RandomizerRegistry; import org.jeasy.random.util.ReflectionUtils; -import javax.validation.constraints.*; +import jakarta.validation.constraints.*; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.util.HashMap; diff --git a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/DecimalMinMaxAnnotationHandler.java b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/DecimalMinMaxAnnotationHandler.java index 20dc10da1..848d9d110 100644 --- a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/DecimalMinMaxAnnotationHandler.java +++ b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/DecimalMinMaxAnnotationHandler.java @@ -26,8 +26,8 @@ import org.jeasy.random.api.Randomizer; import org.jeasy.random.util.ReflectionUtils; -import javax.validation.constraints.DecimalMax; -import javax.validation.constraints.DecimalMin; +import jakarta.validation.constraints.DecimalMax; +import jakarta.validation.constraints.DecimalMin; import java.lang.reflect.Field; import java.math.BigDecimal; diff --git a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/MinMaxAnnotationHandler.java b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/MinMaxAnnotationHandler.java index f94818045..148419426 100644 --- a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/MinMaxAnnotationHandler.java +++ b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/MinMaxAnnotationHandler.java @@ -26,8 +26,8 @@ import org.jeasy.random.api.Randomizer; import org.jeasy.random.util.ReflectionUtils; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; import java.lang.reflect.Field; import java.math.BigDecimal; diff --git a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/PatternAnnotationHandler.java b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/PatternAnnotationHandler.java index b59581cfa..cdfc84b4c 100644 --- a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/PatternAnnotationHandler.java +++ b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/PatternAnnotationHandler.java @@ -27,7 +27,7 @@ import org.jeasy.random.randomizers.RegularExpressionRandomizer; import org.jeasy.random.util.ReflectionUtils; -import javax.validation.constraints.Pattern; +import jakarta.validation.constraints.Pattern; import java.lang.reflect.Field; import java.util.Random; diff --git a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/SizeAnnotationHandler.java b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/SizeAnnotationHandler.java index 27e908c68..21970b603 100644 --- a/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/SizeAnnotationHandler.java +++ b/easy-random-bean-validation/src/main/java/org/jeasy/random/validation/SizeAnnotationHandler.java @@ -31,7 +31,7 @@ import org.jeasy.random.util.ReflectionUtils; import org.objenesis.ObjenesisStd; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; diff --git a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationAnnotatedBean.java b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationAnnotatedBean.java index 4ceec9dd0..f136c83f4 100644 --- a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationAnnotatedBean.java +++ b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationAnnotatedBean.java @@ -23,7 +23,7 @@ */ package org.jeasy.random.validation; -import javax.validation.constraints.*; +import jakarta.validation.constraints.*; import java.math.BigDecimal; import java.time.Instant; import java.time.LocalDateTime; diff --git a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationMethodAnnotatedBean.java b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationMethodAnnotatedBean.java index 917d3c653..595851ae1 100644 --- a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationMethodAnnotatedBean.java +++ b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationMethodAnnotatedBean.java @@ -23,7 +23,7 @@ */ package org.jeasy.random.validation; -import javax.validation.constraints.*; +import jakarta.validation.constraints.*; import java.math.BigDecimal; import java.time.Instant; import java.time.LocalDateTime; diff --git a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationTest.java b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationTest.java index a3933ca6a..48fb0ea95 100644 --- a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationTest.java +++ b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationTest.java @@ -31,16 +31,16 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import javax.validation.ConstraintViolation; -import javax.validation.Valid; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; -import javax.validation.constraints.DecimalMax; -import javax.validation.constraints.DecimalMin; -import javax.validation.constraints.Digits; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Valid; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.ValidatorFactory; +import jakarta.validation.constraints.DecimalMax; +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Date; diff --git a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationWithoutReadMethodBean.java b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationWithoutReadMethodBean.java index fc106f2e1..9d93612d9 100644 --- a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationWithoutReadMethodBean.java +++ b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/BeanValidationWithoutReadMethodBean.java @@ -23,7 +23,7 @@ */ package org.jeasy.random.validation; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotNull; public class BeanValidationWithoutReadMethodBean { diff --git a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/EmbeddedBean.java b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/EmbeddedBean.java index 92aa75205..619a9ef24 100644 --- a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/EmbeddedBean.java +++ b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/EmbeddedBean.java @@ -25,7 +25,7 @@ import java.util.List; -import javax.validation.constraints.Size; +import jakarta.validation.constraints.Size; public class EmbeddedBean { diff --git a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/MyCustomBeanValidationRandomizerRegistry.java b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/MyCustomBeanValidationRandomizerRegistry.java index 5f00b0d99..c1aa8aee8 100644 --- a/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/MyCustomBeanValidationRandomizerRegistry.java +++ b/easy-random-bean-validation/src/test/java/org/jeasy/random/validation/MyCustomBeanValidationRandomizerRegistry.java @@ -23,7 +23,7 @@ */ package org.jeasy.random.validation; -import javax.validation.constraints.Digits; +import jakarta.validation.constraints.Digits; import org.jeasy.random.EasyRandomParameters; diff --git a/easy-random-core/src/test/java/org/jeasy/random/EasyRandomTest.java b/easy-random-core/src/test/java/org/jeasy/random/EasyRandomTest.java index 7011e0f5a..21fcec293 100644 --- a/easy-random-core/src/test/java/org/jeasy/random/EasyRandomTest.java +++ b/easy-random-core/src/test/java/org/jeasy/random/EasyRandomTest.java @@ -231,6 +231,7 @@ void nextEnumShouldNotAlwaysReturnTheSameValue() { } @Test + // this test fails on jdk17 void fieldsOfTypeClassShouldBeSkipped() { try { TestBean testBean = easyRandom.nextObject(TestBean.class); @@ -240,7 +241,7 @@ void fieldsOfTypeClassShouldBeSkipped() { fail("Should skip fields of type Class"); } } - + @Test void differentCollectionsShouldBeRandomizedWithDifferentSizes() { // given @@ -248,10 +249,10 @@ class Foo { List names; List addresses; } - + // when Foo foo = new EasyRandom().nextObject(Foo.class); - + // then assertThat(foo.names.size()).isNotEqualTo(foo.addresses.size()); } @@ -278,10 +279,10 @@ class Base { T t; } class Concrete extends Base {} - + // when Concrete concrete = easyRandom.nextObject(Concrete.class); - + // then assertThat(concrete.t).isInstanceOf(String.class); assertThat(concrete.t).isNotEmpty(); @@ -295,10 +296,10 @@ class Base { S s; } class Concrete extends Base {} - + // when Concrete concrete = easyRandom.nextObject(Concrete.class); - + // then assertThat(concrete.t).isInstanceOf(String.class); assertThat(concrete.s).isInstanceOf(Long.class); @@ -324,7 +325,7 @@ public String getY() { // when Concrete concrete = easyRandom.nextObject(Concrete.class); - + // then assertThat(concrete.getX().getClass()).isEqualTo(Integer.class); assertThat(concrete.getY().getClass()).isEqualTo(String.class); @@ -348,7 +349,7 @@ public String getY() { // when Concrete concrete = easyRandom.nextObject(Concrete.class); - + // then assertThat(concrete.getX().getClass()).isEqualTo(Street.class); assertThat(concrete.getY().getClass()).isEqualTo(String.class); @@ -372,7 +373,7 @@ public String getY() { // when Concrete concrete = easyRandom.nextObject(Concrete.class); - + // then assertThat(concrete.getX().getClass()).isEqualTo(BoundedBaseClass.IntWrapper.class); assertThat(concrete.getY().getClass()).isEqualTo(String.class); @@ -410,7 +411,7 @@ class Concrete extends GenericBaseClass { // when Concrete concrete = easyRandom.nextObject(Concrete.class); - + // then assertThat(concrete.getX()).isInstanceOf(String.class); assertThat(concrete.getY()).isInstanceOf(Long.class); diff --git a/easy-random-core/src/test/java/org/jeasy/random/randomizers/misc/LocaleRandomizerTest.java b/easy-random-core/src/test/java/org/jeasy/random/randomizers/misc/LocaleRandomizerTest.java index 0b374b4bf..f5ac3d1d5 100644 --- a/easy-random-core/src/test/java/org/jeasy/random/randomizers/misc/LocaleRandomizerTest.java +++ b/easy-random-core/src/test/java/org/jeasy/random/randomizers/misc/LocaleRandomizerTest.java @@ -42,9 +42,11 @@ void shouldGenerateRandomLocale() { @Test void shouldGenerateTheSameValueForTheSameSeed() { BigDecimal javaVersion = new BigDecimal(System.getProperty("java.specification.version")); - if (javaVersion.compareTo(new BigDecimal("14")) >= 0) { + if (javaVersion.compareTo(new BigDecimal("17")) >= 0) { + assertThat(new LocaleRandomizer(SEED).getRandomValue()).isEqualTo(new Locale("mni", "")); + } else if (javaVersion.compareTo(new BigDecimal("14")) >= 0) { assertThat(new LocaleRandomizer(SEED).getRandomValue()).isEqualTo(new Locale("rn", "BI")); - } else if (javaVersion.compareTo(new BigDecimal("13")) >= 0) { + }else if (javaVersion.compareTo(new BigDecimal("13")) >= 0) { assertThat(new LocaleRandomizer(SEED).getRandomValue()).isEqualTo(new Locale("zh", "CN")); } else if (javaVersion.compareTo(new BigDecimal("11")) >= 0) { assertThat(new LocaleRandomizer(SEED).getRandomValue()).isEqualTo(new Locale("en", "CK")); diff --git a/pom.xml b/pom.xml index 15f7fe124..570c796a5 100644 --- a/pom.xml +++ b/pom.xml @@ -23,11 +23,11 @@ 5.9.3 1.0.2 3.24.2 - 2.0.1.Final + 3.0.2 3.3 4.8.160 8.0.1.Final - 3.0.0 + 4.0.2 5.4.0 3.1.2 3.11.0 @@ -98,8 +98,8 @@ ${project.version} - javax.validation - validation-api + jakarta.validation + jakarta.validation-api ${validation-api.version} @@ -114,14 +114,14 @@ true - org.hibernate + org.hibernate.validator hibernate-validator ${hibernate-validator.version} org.glassfish - javax.el - ${javax.el.version} + jakarta.el + ${jakarta.el.version} com.github.javafaker