Skip to content

Commit

Permalink
Bump org.hamcrest:hamcrest-library from 2.2 to 3.0 (#527)
Browse files Browse the repository at this point in the history
* Bump org.hamcrest:hamcrest-library from 2.2 to 3.0

Bumps [org.hamcrest:hamcrest-library](https://github.com/hamcrest/JavaHamcrest) from 2.2 to 3.0.
- [Release notes](https://github.com/hamcrest/JavaHamcrest/releases)
- [Changelog](https://github.com/hamcrest/JavaHamcrest/blob/master/CHANGES.md)
- [Commits](hamcrest/JavaHamcrest@v2.2...v3.0)

---
updated-dependencies:
- dependency-name: org.hamcrest:hamcrest-library
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Latest best praticles for java projects

* Stop using hamcrest assertions

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marvin Froeder <[email protected]>
  • Loading branch information
dependabot[bot] and velo authored Aug 5, 2024
1 parent 8e9c9ce commit f931de8
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 62 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@
<configuration>
<rules>
<dependencyConvergence></dependencyConvergence>
<bannedDependencies>
<excludes>
<exclude>org.hamcrest:*:*:*:*</exclude>
</excludes>
<searchTransitive>false</searchTransitive>
</bannedDependencies>
</rules>
</configuration>
</execution>
Expand Down
6 changes: 0 additions & 6 deletions querydsl-examples/querydsl-example-jpa-guice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>

<!-- TEST dependencies -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
</dependencies>

<pluginRepositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions querydsl-examples/querydsl-example-jpa-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
4 changes: 4 additions & 0 deletions querydsl-examples/querydsl-example-kotlin-mongodb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
4 changes: 0 additions & 4 deletions querydsl-examples/querydsl-example-r2dbc-sql-codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@
</dependency>

<!-- TEST dependencies -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions querydsl-examples/querydsl-example-sql-guice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>

<!-- TEST dependencies -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
4 changes: 0 additions & 4 deletions querydsl-examples/querydsl-example-sql-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@
</dependency>

<!-- TEST dependencies -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);");
Expand Down
6 changes: 0 additions & 6 deletions querydsl-tooling/querydsl-codegen-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
</dependency>

<!-- test -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
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;
import java.nio.charset.StandardCharsets;
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();
Expand All @@ -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);
}
}
}
7 changes: 0 additions & 7 deletions querydsl-tooling/querydsl-kotlin-codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand All @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f931de8

Please sign in to comment.