Skip to content

Commit

Permalink
Merge branch 'release/2.0.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Linder committed Jul 24, 2023
2 parents 8cb9598 + 6e25937 commit f1a44e7
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 51 deletions.
3 changes: 2 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
java adoptopenjdk-11.0.7+10.1
java temurin-11.0.19+7
maven 3.9.0
56 changes: 29 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
<parent>
<groupId>ch.dvbern.oss.maven</groupId>
<artifactId>parent</artifactId>
<version>3.0.5</version>
<version>5.0.0</version>
</parent>

<groupId>ch.dvbern.oss.junit-beanvalidation-extension</groupId>
<artifactId>junit-beanvalidation-extension</artifactId>
<version>1.0.3</version>
<version>2.0.0</version>

<name>DV Bern JUnit BeanValidation Extension</name>
<description>Allow for easy injection and customization of a Java BeanValidation Validator into your tests</description>
Expand Down Expand Up @@ -62,70 +62,78 @@
</scm>

<properties>

<maven-compiler-plugin.source>11</maven-compiler-plugin.source>
<maven-compiler-plugin.target>11</maven-compiler-plugin.target>
</properties>

<dependencies>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>3.11.0</version>
<version>3.36.0</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.1</version>
<version>5.9.3</version>
<scope>provided</scope>
</dependency>

<!-- START: minimal dependencies to make this work -->
<dependency>
<!-- validation API spec -->
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<!-- transitive requirement of the validtion API -->
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>5.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- we need an implementation for el-api -->
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.0</version>
<artifactId>jakarta.el</artifactId>
<version>4.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- validation API implementation (hibernate-validaor is just used as an example) -->
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.2.0.Final</version>
<version>8.0.0.Final</version>
<scope>test</scope>
</dependency>
<!-- END: minimal dependencies to make this work -->

<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>2.0</version>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>4.0.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.19.0</version>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.8.0</version>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.24.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>3.8.0</version>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -145,16 +153,10 @@
<plugin>
<groupId>ch.dvbern.oss.maven.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>${jgitflow-maven-plugin.version}</version>
<configuration>
<flowInitContext>
<!-- github changed default names -->
<masterBranchName>main</masterBranchName>
<developBranchName>develop</developBranchName>
<featureBranchPrefix>feature/</featureBranchPrefix>
<releaseBranchPrefix>release/</releaseBranchPrefix>
<hotfixBranchPrefix>hotfix/</hotfixBranchPrefix>
<versionTagPrefix />
</flowInitContext>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import java.util.function.BiFunction;

import javax.validation.ConstraintValidatorFactory;
import javax.validation.ValidatorContext;
import jakarta.validation.ConstraintValidatorFactory;
import jakarta.validation.ValidatorContext;

@FunctionalInterface
public interface ContextCustomizer extends BiFunction<ValidatorContext, ConstraintValidatorFactory, ValidatorContext> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import java.util.HashMap;
import java.util.Map;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorFactory;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorFactory;

import static java.util.Objects.requireNonNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.Map;
import java.util.function.Function;

import javax.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidator;

import static java.util.stream.Collectors.toMap;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ch.dvbern.oss.junitbeanvalidationextension;

import javax.validation.ValidatorContext;
import javax.validation.ValidatorFactory;
import jakarta.validation.ValidatorContext;
import jakarta.validation.ValidatorFactory;

class ValidatorCustomizerImpl implements ValidatorCustomizer {
private ContextCustomizer customizer = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package ch.dvbern.oss.junitbeanvalidationextension;

import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorContext;
import javax.validation.ValidatorFactory;

import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorContext;
import jakarta.validation.ValidatorFactory;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -109,7 +108,8 @@ private void rejectTestMethod(InvocationOn invocationOn) {
throw new IllegalArgumentException(
String.format(
"Injecting the %s into test methods is not supported",
ValidatorCustomizer.class.getSimpleName()));
ValidatorCustomizer.class.getSimpleName()
));
}
}

Expand Down Expand Up @@ -165,7 +165,8 @@ private Validator createValidator(ExtensionContext context) {

ValidatorFactory factory = requireNonNull(
(ValidatorFactory) store.get(DEFAULT_FACTORY),
"ValidatorFactory instance not found in Test context store???");
"ValidatorFactory instance not found in Test context store???"
);

ValidatorContext ctx = applyCustomizers(factory, store);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import java.util.Set;

import javax.validation.ConstraintViolation;
import javax.validation.Validator;

import ch.dvbern.oss.junitbeanvalidationextension.Customizations;
import ch.dvbern.oss.junitbeanvalidationextension.ValidatorCustomizer;
import ch.dvbern.oss.junitbeanvalidationextension.ValidatorExtension;
import ch.dvbern.oss.junitbeanvalidationextension.demo.fixtures.CustomConstraintValidator;
import ch.dvbern.oss.junitbeanvalidationextension.demo.fixtures.SomeFixture;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ch.dvbern.oss.junitbeanvalidationextension.demo.fixtures;

import javax.inject.Inject;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import jakarta.inject.Inject;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class CustomConstraintValidator implements ConstraintValidator<CustomConstraint, Object> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.dvbern.oss.junitbeanvalidationextension.demo.fixtures;

import javax.validation.constraints.NotNull;
import jakarta.validation.constraints.NotNull;

@CustomConstraint
public class SomeFixture {
Expand Down

0 comments on commit f1a44e7

Please sign in to comment.