diff --git a/pom.xml b/pom.xml index 863b212232..0a34148f46 100644 --- a/pom.xml +++ b/pom.xml @@ -431,6 +431,12 @@ + + + org.hamcrest:*:*:*:* + + false + diff --git a/querydsl-examples/querydsl-example-jpa-guice/pom.xml b/querydsl-examples/querydsl-example-jpa-guice/pom.xml index 74a4d6f5fe..b9b4970fe5 100644 --- a/querydsl-examples/querydsl-example-jpa-guice/pom.xml +++ b/querydsl-examples/querydsl-example-jpa-guice/pom.xml @@ -74,12 +74,6 @@ h2 test - - - - org.junit.vintage - junit-vintage-engine - diff --git a/querydsl-examples/querydsl-example-jpa-quarkus/src/test/java/com/querydsl/example/FruitsEndpointTest.java b/querydsl-examples/querydsl-example-jpa-quarkus/src/test/java/com/querydsl/example/FruitsEndpointTest.java index b3d49d13b5..68d268ca3b 100644 --- a/querydsl-examples/querydsl-example-jpa-quarkus/src/test/java/com/querydsl/example/FruitsEndpointTest.java +++ b/querydsl-examples/querydsl-example-jpa-quarkus/src/test/java/com/querydsl/example/FruitsEndpointTest.java @@ -2,7 +2,7 @@ import static io.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.core.IsNot.not; +import static org.hamcrest.Matchers.not; import io.quarkus.test.junit.QuarkusTest; import org.junit.jupiter.api.Test; diff --git a/querydsl-examples/querydsl-example-jpa-spring/pom.xml b/querydsl-examples/querydsl-example-jpa-spring/pom.xml index 8e94963df9..e1bbc40cf7 100755 --- a/querydsl-examples/querydsl-example-jpa-spring/pom.xml +++ b/querydsl-examples/querydsl-example-jpa-spring/pom.xml @@ -55,6 +55,12 @@ org.springframework.boot spring-boot-starter-test test + + + org.hamcrest + hamcrest + + diff --git a/querydsl-examples/querydsl-example-kotlin-mongodb/pom.xml b/querydsl-examples/querydsl-example-kotlin-mongodb/pom.xml index 1a0a2f1a90..8b08a06719 100644 --- a/querydsl-examples/querydsl-example-kotlin-mongodb/pom.xml +++ b/querydsl-examples/querydsl-example-kotlin-mongodb/pom.xml @@ -35,6 +35,10 @@ org.junit.vintage junit-vintage-engine + + org.hamcrest + hamcrest + diff --git a/querydsl-examples/querydsl-example-r2dbc-sql-codegen/pom.xml b/querydsl-examples/querydsl-example-r2dbc-sql-codegen/pom.xml index 634f2cf6ae..df163b5ae9 100644 --- a/querydsl-examples/querydsl-example-r2dbc-sql-codegen/pom.xml +++ b/querydsl-examples/querydsl-example-r2dbc-sql-codegen/pom.xml @@ -61,10 +61,6 @@ - - org.junit.vintage - junit-vintage-engine - org.springframework spring-test diff --git a/querydsl-examples/querydsl-example-sql-guice/pom.xml b/querydsl-examples/querydsl-example-sql-guice/pom.xml index 8ea7ce13b1..0d328955c6 100644 --- a/querydsl-examples/querydsl-example-sql-guice/pom.xml +++ b/querydsl-examples/querydsl-example-sql-guice/pom.xml @@ -40,12 +40,6 @@ c3p0 0.9.1.2 - - - - org.junit.vintage - junit-vintage-engine - diff --git a/querydsl-examples/querydsl-example-sql-spring/pom.xml b/querydsl-examples/querydsl-example-sql-spring/pom.xml index 1c43bed6ac..fe2e2d6741 100644 --- a/querydsl-examples/querydsl-example-sql-spring/pom.xml +++ b/querydsl-examples/querydsl-example-sql-spring/pom.xml @@ -59,10 +59,6 @@ - - org.junit.vintage - junit-vintage-engine - org.springframework spring-test diff --git a/querydsl-libraries/querydsl-mongodb/src/test/java/com/querydsl/mongodb/PackageVerification.java b/querydsl-libraries/querydsl-mongodb/src/test/java/com/querydsl/mongodb/PackageVerification.java index 0640a30946..78959d1adc 100644 --- a/querydsl-libraries/querydsl-mongodb/src/test/java/com/querydsl/mongodb/PackageVerification.java +++ b/querydsl-libraries/querydsl-mongodb/src/test/java/com/querydsl/mongodb/PackageVerification.java @@ -25,7 +25,7 @@ import java.net.URLClassLoader; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Paths; +import java.nio.file.Path; import org.junit.Test; public class PackageVerification { @@ -53,7 +53,7 @@ private void verify(File oneJar) throws Exception { var resourceKey = "META-INF/services/javax.annotation.processing.Processor"; assertThat( new String( - Files.readAllBytes(Paths.get(oneJarClassLoader.findResource(resourceKey).toURI())), + Files.readAllBytes(Path.of(oneJarClassLoader.findResource(resourceKey).toURI())), StandardCharsets.UTF_8)) .isEqualTo(MorphiaAnnotationProcessor.class.getName()); } diff --git a/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/BooleanExtensionsTest.java b/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/BooleanExtensionsTest.java index 7a968d9371..54f1ed4457 100644 --- a/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/BooleanExtensionsTest.java +++ b/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/BooleanExtensionsTest.java @@ -19,7 +19,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.Arrays; import java.util.List; import org.junit.Test; @@ -39,7 +39,7 @@ public void process() throws IOException { var qtypeContent = new String( Files.readAllBytes( - Paths.get("target", "booleanExtensions", "com", "querydsl", "QExampleEntity.java")), + Path.of("target", "booleanExtensions", "com", "querydsl", "QExampleEntity.java")), StandardCharsets.UTF_8); assertThat(qtypeContent).contains("ext.java.lang.QBoolean booleanProp"); assertThat(qtypeContent).contains("ext.java.lang.QBoolean booleanProp2"); @@ -55,8 +55,7 @@ public void process2() throws IOException { var qtypeContent = new String( Files.readAllBytes( - Paths.get( - "target", "booleanExtensions2", "com", "querydsl", "QExampleEntity.java")), + Path.of("target", "booleanExtensions2", "com", "querydsl", "QExampleEntity.java")), StandardCharsets.UTF_8); assertThat(qtypeContent).contains("ext.java.lang.QBoolean booleanProp"); assertThat(qtypeContent).contains("ext.java.lang.QBoolean booleanProp2"); diff --git a/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/IntegerExtensionsTest.java b/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/IntegerExtensionsTest.java index a9336f18a3..48f6e42ccc 100644 --- a/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/IntegerExtensionsTest.java +++ b/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/IntegerExtensionsTest.java @@ -6,7 +6,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.Arrays; import java.util.List; import org.junit.Test; @@ -25,8 +25,7 @@ public void process() throws IOException { var qtypeContent = new String( Files.readAllBytes( - Paths.get( - "target", "integerExtensions", "com", "querydsl", "QExampleEntity2.java")), + Path.of("target", "integerExtensions", "com", "querydsl", "QExampleEntity2.java")), StandardCharsets.UTF_8); // The superclass' id property is inherited, but can't be assigned to the custom QInteger assertThat(qtypeContent) diff --git a/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/domain/InnerExtensionsTest.java b/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/domain/InnerExtensionsTest.java index cd8c981aa2..17f9f1cf4d 100644 --- a/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/domain/InnerExtensionsTest.java +++ b/querydsl-tooling/querydsl-apt/src/test/java/com/querydsl/apt/domain/InnerExtensionsTest.java @@ -8,7 +8,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.Arrays; import java.util.List; import org.junit.Test; @@ -27,7 +27,7 @@ public void process() throws IOException { var qtypeContent = new String( Files.readAllBytes( - Paths.get("target", "innerextensions", "com", "querydsl", "QExampleEntity2.java")), + Path.of("target", "innerextensions", "com", "querydsl", "QExampleEntity2.java")), StandardCharsets.UTF_8); assertThat(qtypeContent) .contains("return InnerExtensions.ExampleEntity2Extensions.isZero(this);"); diff --git a/querydsl-tooling/querydsl-codegen-utils/pom.xml b/querydsl-tooling/querydsl-codegen-utils/pom.xml index d4fdde7cfd..66101555d2 100644 --- a/querydsl-tooling/querydsl-codegen-utils/pom.xml +++ b/querydsl-tooling/querydsl-codegen-utils/pom.xml @@ -31,12 +31,6 @@ - - org.junit.vintage - junit-vintage-engine - test - - jakarta.validation jakarta.validation-api diff --git a/querydsl-tooling/querydsl-jpa-codegen/src/test/java/com/querydsl/jpa/codegen/ant/AntJPADomainExporterTest.java b/querydsl-tooling/querydsl-jpa-codegen/src/test/java/com/querydsl/jpa/codegen/ant/AntJPADomainExporterTest.java index bcef7f8a90..0522df1d29 100644 --- a/querydsl-tooling/querydsl-jpa-codegen/src/test/java/com/querydsl/jpa/codegen/ant/AntJPADomainExporterTest.java +++ b/querydsl-tooling/querydsl-jpa-codegen/src/test/java/com/querydsl/jpa/codegen/ant/AntJPADomainExporterTest.java @@ -1,8 +1,6 @@ package com.querydsl.jpa.codegen.ant; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; import java.io.File; import java.io.IOException; @@ -10,15 +8,12 @@ import java.nio.file.Files; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ErrorCollector; import org.junit.rules.TemporaryFolder; public class AntJPADomainExporterTest { @Rule public TemporaryFolder folder = new TemporaryFolder(); - @Rule public ErrorCollector errors = new ErrorCollector(); - @Test public void test() throws IOException { var exporter = new AntJPADomainExporter(); @@ -40,7 +35,7 @@ public void test() throws IOException { var reference = new String(java.nio.file.Files.readAllBytes(origFile), StandardCharsets.UTF_8); var content = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); - errors.checkThat("Mismatch for " + file.getPath(), content, is(equalTo(reference))); + assertThat(content).withFailMessage("Mismatch for %s", file.getPath()).isEqualTo(reference); } } } diff --git a/querydsl-tooling/querydsl-kotlin-codegen/pom.xml b/querydsl-tooling/querydsl-kotlin-codegen/pom.xml index 327b6fe220..1131491742 100644 --- a/querydsl-tooling/querydsl-kotlin-codegen/pom.xml +++ b/querydsl-tooling/querydsl-kotlin-codegen/pom.xml @@ -66,13 +66,6 @@ jakarta.inject jakarta.inject-api - - - org.hamcrest - hamcrest-library - 2.2 - test - diff --git a/querydsl-tooling/querydsl-kotlin-codegen/src/test/kotlin/com/querydsl/kotlin/codegen/EmbeddableSerializerTest.kt b/querydsl-tooling/querydsl-kotlin-codegen/src/test/kotlin/com/querydsl/kotlin/codegen/EmbeddableSerializerTest.kt index beae6d8183..e68cbcfeb9 100644 --- a/querydsl-tooling/querydsl-kotlin-codegen/src/test/kotlin/com/querydsl/kotlin/codegen/EmbeddableSerializerTest.kt +++ b/querydsl-tooling/querydsl-kotlin-codegen/src/test/kotlin/com/querydsl/kotlin/codegen/EmbeddableSerializerTest.kt @@ -31,11 +31,11 @@ import com.querydsl.codegen.utils.model.Types import com.querydsl.core.annotations.Generated import com.querydsl.core.annotations.PropertyType import com.querydsl.kotlin.codegen.CompileUtils.assertCompiles -import org.hamcrest.Matchers import org.junit.Assert import org.junit.Ignore import org.junit.Test import org.junit.jupiter.api.Assertions +import org.assertj.core.api.Assertions.assertThat import java.io.StringWriter import java.sql.Time @@ -183,8 +183,8 @@ class EmbeddableSerializerTest { typeMappings.register(entityType, queryTypeFactory.create(entityType)) serializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, JavaWriter(writer)) val generatedSource = writer.toString() - Assert.assertThat(generatedSource, Matchers.containsString("import $generatedAnnotationImport")) - Assert.assertThat(generatedSource, Matchers.containsString("@Generated(\"com.querydsl.kotlin.codegen.KotlinEmbeddableSerializer\")\npublic class")) + assertThat(generatedSource).contains("import $generatedAnnotationImport") + assertThat(generatedSource).contains("@Generated(\"com.querydsl.kotlin.codegen.KotlinEmbeddableSerializer\")\npublic class") assertCompiles("QEntity", generatedSource) } @@ -195,7 +195,7 @@ class EmbeddableSerializerTest { typeMappings.register(entityType, queryTypeFactory.create(entityType)) KotlinEmbeddableSerializer(typeMappings, emptySet(), Generated::class.java).serialize(entityType, SimpleSerializerConfig.DEFAULT, JavaWriter(writer)) val generatedSourceCode = writer.toString() - Assert.assertThat(generatedSourceCode, Matchers.containsString("@Generated(\"com.querydsl.kotlin.codegen.KotlinEmbeddableSerializer\")\npublic class")) + assertThat(generatedSourceCode).contains("@Generated(\"com.querydsl.kotlin.codegen.KotlinEmbeddableSerializer\")\npublic class") assertCompiles("QEntity", generatedSourceCode) } } \ No newline at end of file diff --git a/querydsl-tooling/querydsl-kotlin-codegen/src/test/kotlin/com/querydsl/kotlin/codegen/ProjectionSerializerTest.kt b/querydsl-tooling/querydsl-kotlin-codegen/src/test/kotlin/com/querydsl/kotlin/codegen/ProjectionSerializerTest.kt index 2810975b22..7a9b2522f4 100644 --- a/querydsl-tooling/querydsl-kotlin-codegen/src/test/kotlin/com/querydsl/kotlin/codegen/ProjectionSerializerTest.kt +++ b/querydsl-tooling/querydsl-kotlin-codegen/src/test/kotlin/com/querydsl/kotlin/codegen/ProjectionSerializerTest.kt @@ -25,7 +25,7 @@ import com.querydsl.codegen.utils.model.Type import com.querydsl.codegen.utils.model.TypeCategory import com.querydsl.codegen.utils.model.Types import com.querydsl.core.annotations.Generated -import org.hamcrest.Matchers +import org.assertj.core.api.Assertions.assertThat import org.junit.Assert import org.junit.Test import org.junit.jupiter.api.Assertions @@ -61,8 +61,8 @@ class ProjectionSerializerTest { val serializer: ProjectionSerializer = KotlinProjectionSerializer(KotlinTypeMappings()) serializer.serialize(type, SimpleSerializerConfig.DEFAULT, JavaWriter(writer)) val generatedSource = writer.toString() - Assert.assertThat(generatedSource, Matchers.containsString("import $generatedAnnotationImport")) - Assert.assertThat(generatedSource, Matchers.containsString("@Generated(\"com.querydsl.kotlin.codegen.KotlinProjectionSerializer\")\npublic class")) + assertThat(generatedSource).contains("import $generatedAnnotationImport") + assertThat(generatedSource).contains("@Generated(\"com.querydsl.kotlin.codegen.KotlinProjectionSerializer\")\npublic class") } @Test @@ -73,7 +73,7 @@ class ProjectionSerializerTest { val serializer: ProjectionSerializer = KotlinProjectionSerializer(KotlinTypeMappings(), Generated::class.java) serializer.serialize(type, SimpleSerializerConfig.DEFAULT, JavaWriter(writer)) val generatedSource = writer.toString() - Assert.assertThat(generatedSource, Matchers.containsString("import com.querydsl.core.annotations.Generated")) - Assert.assertThat(generatedSource, Matchers.containsString("@Generated(\"com.querydsl.kotlin.codegen.KotlinProjectionSerializer\")\npublic class")) + assertThat(generatedSource).contains("import com.querydsl.core.annotations.Generated") + assertThat(generatedSource).contains("@Generated(\"com.querydsl.kotlin.codegen.KotlinProjectionSerializer\")\npublic class") } } \ No newline at end of file diff --git a/querydsl-tooling/querydsl-sql-codegen/src/test/java/com/querydsl/sql/codegen/CustomTypesTest.java b/querydsl-tooling/querydsl-sql-codegen/src/test/java/com/querydsl/sql/codegen/CustomTypesTest.java index 272ab600c3..61b95a0ace 100644 --- a/querydsl-tooling/querydsl-sql-codegen/src/test/java/com/querydsl/sql/codegen/CustomTypesTest.java +++ b/querydsl-tooling/querydsl-sql-codegen/src/test/java/com/querydsl/sql/codegen/CustomTypesTest.java @@ -31,7 +31,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Paths; +import java.nio.file.Path; import java.sql.SQLException; import org.junit.Before; import org.junit.Test; @@ -81,7 +81,7 @@ public void export() throws SQLException, IOException { // export exporter.export(connection.getMetaData()); - var qpersonFile = Paths.get("target", "customExport", "test", "QPerson.java"); + var qpersonFile = Path.of("target", "customExport", "test", "QPerson.java"); assertThat(qpersonFile).exists(); var person = new String(Files.readAllBytes(qpersonFile), StandardCharsets.UTF_8); // System.err.println(person);