Skip to content

Commit

Permalink
Java 17 and JUnit5 (#9)
Browse files Browse the repository at this point in the history
* Updated Maven Wrapper
* Migrated to Junit5 and cleanup
* Changed to Java 17
  • Loading branch information
michael-schnell authored Dec 27, 2023
1 parent bc5dc4b commit cafa758
Show file tree
Hide file tree
Showing 163 changed files with 884 additions and 1,097 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'zulu'
cache: maven

Expand Down
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ A library with common Java types that are mostly immutable value objects.
[![Coverage Status](https://sonarcloud.io/api/project_badges/measure?project=org.fuin%3Aobjects4j&metric=coverage)](https://sonarcloud.io/dashboard?id=org.fuin%3Aobjects4j)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.fuin/objects4j/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.fuin/objects4j/)
[![LGPLv3 License](http://img.shields.io/badge/license-LGPLv3-blue.svg)](https://www.gnu.org/licenses/lgpl.html)
[![Java Development Kit 11](https://img.shields.io/badge/JDK-11-green.svg)](https://openjdk.java.net/projects/jdk/11/)
[![Java Development Kit 17](https://img.shields.io/badge/JDK-17-green.svg)](https://openjdk.java.net/projects/jdk/17/)

## Versions
- 0.8.x (or later) = **Java 11** with new **jakarta** namespace
- 0.9.x (or later) = **Java 17**
- 0.8.0 = **Java 11** with new **jakarta** namespace
- 0.7.x = **Java 11** before namespace change from 'javax' to 'jakarta'
- 0.6.9 (or previous) = **Java 8**

Expand Down
82 changes: 45 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<parent>
<groupId>org.fuin</groupId>
<artifactId>pom</artifactId>
<version>1.8.0-SNAPSHOT</version>
<version>1.9.0</version>
</parent>

<artifactId>objects4j</artifactId>
<packaging>bundle</packaging>
<version>0.8.1-SNAPSHOT</version>
<version>0.9.0-SNAPSHOT</version>

<description>A library with common Java types that are mostly immutable value objects.</description>
<url>http://www.fuin.org/objects4j/</url>
Expand All @@ -35,86 +35,86 @@
<dependency>
<groupId>org.fuin</groupId>
<artifactId>utils4j</artifactId>
<version>0.12.1-SNAPSHOT</version>
<version>0.13.0</version>
</dependency>


<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.0</version>
<version>4.0.1</version>
</dependency>

<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.0.1</version>
<version>2.1.3</version>
</dependency>

<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<version>2.0.0</version>
<version>3.0.0</version>
</dependency>

<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.0.0</version>
<version>3.0.2</version>
</dependency>

<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>3.0.0</version>
<version>4.0.1</version>
</dependency>

<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
</dependency>

<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
<version>2.0.1</version>
<version>2.1.2</version>
</dependency>

<!-- Test -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.20.2</version>
<version>3.24.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.fuin</groupId>
<artifactId>units4j</artifactId>
<version>0.10.1-SNAPSHOT</version>
<version>0.11.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>4.3</version>
<version>5.2.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>4.0.0</version>
<version>5.0.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -128,56 +128,56 @@
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>4.0.2.Final</version>
<version>5.1.2.Final</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss</groupId>
<artifactId>jandex</artifactId>
<version>2.4.0.Final</version>
<version>3.1.6</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
<version>2.0.9</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.30</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.4.14</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.14</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>7.0.1.Final</version>
<version>8.0.1.Final</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>3.0.0</version>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.4.1.Final</version>
<scope>test</scope>
</dependency>
</dependency>

<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.6.0</version>
<version>2.7.2</version>
<scope>test</scope>
</dependency>
<!--
Expand All @@ -191,21 +191,21 @@
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.7.1</version>
<version>3.15.5</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-jre</version>
<version>33.0.0-jre</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.8.2</version>
<version>2.9.1</version>
<scope>test</scope>
</dependency>

Expand All @@ -219,14 +219,14 @@
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>3.0.2</version>
<version>4.0.4</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<version>2.0.2</version>
<version>3.0.3</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -278,6 +278,14 @@
<artifactId>maven-jdeps-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--add-opens java.base/java.util=ALL-UNNAMED</argLine>
</configuration>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
*/
package org.fuin.objects4j.common;

import jakarta.validation.ConstraintViolation;

import java.util.Collections;
import java.util.Set;

import jakarta.validation.ConstraintViolation;

/**
* The contract that was checked is violated.
*/
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/org/fuin/objects4j/common/Contract.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@
*/
package org.fuin.objects4j.common;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.groups.Default;

import java.util.*;

/**
* Utility class for assertions on objects.
*/
Expand Down Expand Up @@ -214,7 +210,7 @@ public static void requireValid(@NotNull final Validator validator, @NotNull fin
// CHECKSTYLE:ON

final Set<ConstraintViolation<Object>> constraintViolations = validator.validate(value);
if (constraintViolations.size() > 0) {
if (!constraintViolations.isEmpty()) {
final StringBuilder sb = new StringBuilder();
for (final ConstraintViolation<Object> constraintViolation : constraintViolations) {
if (sb.length() > 0) {
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/org/fuin/objects4j/common/FileExists.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@
*/
package org.fuin.objects4j.common;

import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* Checks if the file exists.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
*/
package org.fuin.objects4j.common;

import java.io.File;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import jakarta.validation.constraints.NotNull;

import java.io.File;

/**
* Checks if the file exists.
*/
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/org/fuin/objects4j/common/Immutable.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
*/
package org.fuin.objects4j.common;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.*;

/**
* The class to which this annotation is applied is immutable. This means that its state cannot be seen to change by callers. Of necessity
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/org/fuin/objects4j/common/IsDirectory.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@
*/
package org.fuin.objects4j.common;

import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* Checks if it's a directory (and not a file).
Expand Down
Loading

0 comments on commit cafa758

Please sign in to comment.