diff --git a/pom.xml b/pom.xml index e42a790..142fc9c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ fr.ouestfrance.querydsl querydsl - 1.1.1-SNAPSHOT + 1.2.0-SNAPSHOT querydsl Unified queryDSL based on annotations https://github.com/ouest-france/querydsl diff --git a/src/main/java/fr/ouestfrance/querydsl/FilterField.java b/src/main/java/fr/ouestfrance/querydsl/FilterField.java index 627e60e..170b628 100644 --- a/src/main/java/fr/ouestfrance/querydsl/FilterField.java +++ b/src/main/java/fr/ouestfrance/querydsl/FilterField.java @@ -25,15 +25,18 @@ * * @return operation type */ - FilterOperation operation() default FilterOperation.EQ; + Class operation() default FilterOperation.EQ.class; /** * Should handle null possible value (isNull or isEqualsTo(XXX)) + * * @return true is should handle null, otherwise false */ boolean orNull() default false; + /** * Group the filter in "or group" every filter with "orGroup" will be joined together + * * @return group name */ String groupName() default ""; diff --git a/src/main/java/fr/ouestfrance/querydsl/FilterOperation.java b/src/main/java/fr/ouestfrance/querydsl/FilterOperation.java index 2d72b84..9374f6f 100644 --- a/src/main/java/fr/ouestfrance/querydsl/FilterOperation.java +++ b/src/main/java/fr/ouestfrance/querydsl/FilterOperation.java @@ -1,43 +1,45 @@ package fr.ouestfrance.querydsl; -/** - * Type of operations - */ -public enum FilterOperation { - /** - * Should be equals - */ - EQ, - /** - * Should contains data - */ - LIKE, - /** - * Should be greater than - */ - GT, - /** - * Should be greater than or equals to - */ - GTE, - /** - * Should be less than - */ - LT, - /** - * Should be less than or equals to - */ - LTE, - /** - * Should be not equals to - */ - NEQ, - /** - * Should be in a specific list - */ - IN, - /** - * Should not be in a specific list - */ - NOT_IN +import fr.ouestfrance.querydsl.service.validators.ValidatedBy; +import fr.ouestfrance.querydsl.service.validators.impl.CollectionValidator; +import fr.ouestfrance.querydsl.service.validators.impl.ComparableValidator; +import fr.ouestfrance.querydsl.service.validators.impl.StringValidator; + +public interface FilterOperation { + + @ValidatedBy(ComparableValidator.class) + class NEQ implements FilterOperation { + } + + @ValidatedBy(ComparableValidator.class) + class EQ implements FilterOperation { + } + + @ValidatedBy(ComparableValidator.class) + class GT implements FilterOperation { + } + + @ValidatedBy(ComparableValidator.class) + class GTE implements FilterOperation { + } + + @ValidatedBy(ComparableValidator.class) + class LT implements FilterOperation { + } + + @ValidatedBy(ComparableValidator.class) + class LTE implements FilterOperation { + } + + @ValidatedBy(StringValidator.class) + class LIKE implements FilterOperation { + } + + @ValidatedBy(CollectionValidator.class) + class IN implements FilterOperation { + } + + @ValidatedBy(CollectionValidator.class) + class NOTIN implements FilterOperation { + } } diff --git a/src/main/java/fr/ouestfrance/querydsl/model/SimpleFilter.java b/src/main/java/fr/ouestfrance/querydsl/model/SimpleFilter.java index 8e487d8..ced180a 100644 --- a/src/main/java/fr/ouestfrance/querydsl/model/SimpleFilter.java +++ b/src/main/java/fr/ouestfrance/querydsl/model/SimpleFilter.java @@ -6,10 +6,12 @@ /** * FilterFieldInfoModel allow to store object representation of FilterField Annotation - * @param key key of the criteria + * + * @param key key of the criteria * @param operation operator to apply - * @param orNull allow the field to be null - * @param field field of the field representing type, method accessor and field name + * @param orNull allow the field to be null + * @param field field of the field representing type, method accessor and field name */ -public record SimpleFilter(String key, FilterOperation operation, boolean orNull, Field field) implements Filter { +public record SimpleFilter(String key, Class operation, boolean orNull, + Field field) implements Filter { } diff --git a/src/main/java/fr/ouestfrance/querydsl/service/ext/Mapper.java b/src/main/java/fr/ouestfrance/querydsl/service/ext/Mapper.java index 0fd769b..8d98351 100644 --- a/src/main/java/fr/ouestfrance/querydsl/service/ext/Mapper.java +++ b/src/main/java/fr/ouestfrance/querydsl/service/ext/Mapper.java @@ -22,6 +22,7 @@ * } * } * } + * * @param type of result */ public interface Mapper { @@ -40,5 +41,5 @@ public interface Mapper { * * @return operation type */ - FilterOperation operation(); + Class operation(); } diff --git a/src/main/java/fr/ouestfrance/querydsl/service/ext/QueryDslProcessorService.java b/src/main/java/fr/ouestfrance/querydsl/service/ext/QueryDslProcessorService.java index 4fb3483..fd7e060 100644 --- a/src/main/java/fr/ouestfrance/querydsl/service/ext/QueryDslProcessorService.java +++ b/src/main/java/fr/ouestfrance/querydsl/service/ext/QueryDslProcessorService.java @@ -118,7 +118,7 @@ private Optional handleFilter(SimpleFilter filter, Object object) { * @param operation type of operation * @return mapper for this operation */ - Mapper getMapper(FilterOperation operation); + Mapper getMapper(Class operation); /** * Allow to group multiple filters with logical operand diff --git a/src/main/java/fr/ouestfrance/querydsl/service/validators/FilterFieldValidatorService.java b/src/main/java/fr/ouestfrance/querydsl/service/validators/FilterFieldValidatorService.java index 86be046..45a2942 100644 --- a/src/main/java/fr/ouestfrance/querydsl/service/validators/FilterFieldValidatorService.java +++ b/src/main/java/fr/ouestfrance/querydsl/service/validators/FilterFieldValidatorService.java @@ -2,13 +2,10 @@ import fr.ouestfrance.querydsl.FilterOperation; import fr.ouestfrance.querydsl.model.SimpleFilter; -import fr.ouestfrance.querydsl.service.validators.impl.EqualsValidator; -import fr.ouestfrance.querydsl.service.validators.impl.GreaterLessValidator; -import fr.ouestfrance.querydsl.service.validators.impl.InValidator; -import fr.ouestfrance.querydsl.service.validators.impl.LikeValidator; -import java.util.Arrays; -import java.util.List; +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; import java.util.Optional; /** @@ -38,9 +35,9 @@ public class FilterFieldValidatorService { /** - * List of validators + * Map of validators */ - private final List validators = List.of(new EqualsValidator(), new GreaterLessValidator(), new InValidator(), new LikeValidator()); + private static final Map, FilterFieldValidator> VALIDATOR_MAP = new HashMap<>(); /** * Check each filter and build a filter of violations @@ -49,9 +46,12 @@ public class FilterFieldValidatorService { * @return empty filter if everything is ok, otherwise it returns filter of {@link FilterFieldViolation} */ public Optional validate(SimpleFilter filter) { - return getValidator(filter.operation()) - .filter(x-> !x.validate((Class) filter.field().getType())) - .map(x -> new FilterFieldViolation(filter.field().getName(), "Operation " + filter.operation() + " " + x.message())); + FilterFieldValidator validator = getValidator(filter.operation()); + if (validator.validate(filter.field().getType())) { + return Optional.empty(); + } else { + return Optional.of(new FilterFieldViolation(filter.field().getName(), "Operation " + filter.operation() + " " + validator.message())); + } } /** @@ -60,7 +60,18 @@ public Optional validate(SimpleFilter filter) { * @param operation operation in the FilterField annotation * @return Validator for this field */ - private Optional getValidator(FilterOperation operation) { - return validators.stream().filter(x -> Arrays.asList(x.getClass().getAnnotation(ValidatedBy.class).value()).contains(operation)).findFirst(); + private FilterFieldValidator getValidator(Class operation) { + ValidatedBy validator = operation.getAnnotation(ValidatedBy.class); + if (validator == null) { + throw new IllegalStateException("Operation " + operation + " should be annotated with @ValidatedBy"); + } + return VALIDATOR_MAP.computeIfAbsent(validator.value(), x -> { + try { + return x.getConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | + InvocationTargetException e) { + throw new IllegalStateException("Validator " + x + " should have a default constructor", e); + } + }); } } diff --git a/src/main/java/fr/ouestfrance/querydsl/service/validators/ValidatedBy.java b/src/main/java/fr/ouestfrance/querydsl/service/validators/ValidatedBy.java index aefa8d9..8cc6695 100644 --- a/src/main/java/fr/ouestfrance/querydsl/service/validators/ValidatedBy.java +++ b/src/main/java/fr/ouestfrance/querydsl/service/validators/ValidatedBy.java @@ -17,5 +17,5 @@ * * @return operation */ - FilterOperation[] value(); + Class value(); } diff --git a/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/InValidator.java b/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/CollectionValidator.java similarity index 69% rename from src/main/java/fr/ouestfrance/querydsl/service/validators/impl/InValidator.java rename to src/main/java/fr/ouestfrance/querydsl/service/validators/impl/CollectionValidator.java index 2f76235..2736974 100644 --- a/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/InValidator.java +++ b/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/CollectionValidator.java @@ -1,8 +1,6 @@ package fr.ouestfrance.querydsl.service.validators.impl; -import fr.ouestfrance.querydsl.FilterOperation; import fr.ouestfrance.querydsl.service.validators.FilterFieldValidator; -import fr.ouestfrance.querydsl.service.validators.ValidatedBy; import lombok.NoArgsConstructor; import java.util.Collection; @@ -10,9 +8,8 @@ /** * Validator that handle filter operations containing (IN, NOT_IN) */ -@ValidatedBy({FilterOperation.IN, FilterOperation.NOT_IN}) @NoArgsConstructor -public class InValidator implements FilterFieldValidator { +public class CollectionValidator implements FilterFieldValidator { @Override public boolean validate(Class clazz) { diff --git a/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/EqualsValidator.java b/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/ComparableValidator.java similarity index 85% rename from src/main/java/fr/ouestfrance/querydsl/service/validators/impl/EqualsValidator.java rename to src/main/java/fr/ouestfrance/querydsl/service/validators/impl/ComparableValidator.java index 8b7946c..150325c 100644 --- a/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/EqualsValidator.java +++ b/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/ComparableValidator.java @@ -8,9 +8,8 @@ /** * Validator that handle filter operations giving equalities (EQ, NEQ) */ -@ValidatedBy({FilterOperation.EQ, FilterOperation.NEQ}) @NoArgsConstructor -public class EqualsValidator implements FilterFieldValidator { +public class ComparableValidator implements FilterFieldValidator { @Override public boolean validate(Class clazz) { diff --git a/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/GreaterLessValidator.java b/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/GreaterLessValidator.java deleted file mode 100644 index 5fa7df3..0000000 --- a/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/GreaterLessValidator.java +++ /dev/null @@ -1,24 +0,0 @@ -package fr.ouestfrance.querydsl.service.validators.impl; - -import fr.ouestfrance.querydsl.FilterOperation; -import fr.ouestfrance.querydsl.service.validators.FilterFieldValidator; -import fr.ouestfrance.querydsl.service.validators.ValidatedBy; -import lombok.NoArgsConstructor; - -/** - * Validator that handle filter operations comparable (GT,GTE, LT, LTE) - */ -@ValidatedBy({FilterOperation.GT, FilterOperation.GTE, FilterOperation.LT, FilterOperation.LTE}) -@NoArgsConstructor -public class GreaterLessValidator implements FilterFieldValidator { - - @Override - public boolean validate(Class clazz) { - return Comparable.class.isAssignableFrom(clazz); - } - - @Override - public String message() { - return "should be applied to Comparables values (LocaleDate, LocaleDateTime, String, ...)"; - } -} diff --git a/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/LikeValidator.java b/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/StringValidator.java similarity index 69% rename from src/main/java/fr/ouestfrance/querydsl/service/validators/impl/LikeValidator.java rename to src/main/java/fr/ouestfrance/querydsl/service/validators/impl/StringValidator.java index ba41fb0..4feee2a 100644 --- a/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/LikeValidator.java +++ b/src/main/java/fr/ouestfrance/querydsl/service/validators/impl/StringValidator.java @@ -1,16 +1,13 @@ package fr.ouestfrance.querydsl.service.validators.impl; -import fr.ouestfrance.querydsl.FilterOperation; import fr.ouestfrance.querydsl.service.validators.FilterFieldValidator; -import fr.ouestfrance.querydsl.service.validators.ValidatedBy; import lombok.NoArgsConstructor; /** * Validator that handle filter operations giving like (LIKE) */ -@ValidatedBy({FilterOperation.LIKE}) @NoArgsConstructor -public class LikeValidator implements FilterFieldValidator { +public class StringValidator implements FilterFieldValidator { @Override public boolean validate(Class clazz) { return String.class.isAssignableFrom(clazz); diff --git a/src/test/java/fr/ouestfrance/querydsl/dummy/DummyRequest.java b/src/test/java/fr/ouestfrance/querydsl/dummy/DummyRequest.java index ba7956d..3620107 100644 --- a/src/test/java/fr/ouestfrance/querydsl/dummy/DummyRequest.java +++ b/src/test/java/fr/ouestfrance/querydsl/dummy/DummyRequest.java @@ -18,11 +18,11 @@ public class DummyRequest { @FilterField(key = "productCode") private String code; - @FilterField(operation = FilterOperation.IN, key = "edition") + @FilterField(operation = FilterOperation.IN.class, key = "edition") private List editions; - @FilterField(operation = FilterOperation.GTE, key = "startDate") - @FilterField(operation = FilterOperation.LTE, key = "endDate", orNull = true) + @FilterField(operation = FilterOperation.GTE.class, key = "startDate") + @FilterField(operation = FilterOperation.LTE.class, key = "endDate", orNull = true) private LocalDate validityDate; @FilterField diff --git a/src/test/java/fr/ouestfrance/querydsl/dummy/DummyRequestOrSingleField.java b/src/test/java/fr/ouestfrance/querydsl/dummy/DummyRequestOrSingleField.java index df1ae47..6f887da 100644 --- a/src/test/java/fr/ouestfrance/querydsl/dummy/DummyRequestOrSingleField.java +++ b/src/test/java/fr/ouestfrance/querydsl/dummy/DummyRequestOrSingleField.java @@ -14,8 +14,8 @@ public class DummyRequestOrSingleField { @FilterField(key = "size", groupName = "group1") @FilterFields(groupName = "group1", value = { - @FilterField(key = "minSize", operation = FilterOperation.GTE), - @FilterField(key = "maxSize", operation = FilterOperation.LTE) + @FilterField(key = "minSize", operation = FilterOperation.GTE.class), + @FilterField(key = "maxSize", operation = FilterOperation.LTE.class) }) private String size; diff --git a/src/test/java/fr/ouestfrance/querydsl/dummy/DummyViolatedRulesRequest.java b/src/test/java/fr/ouestfrance/querydsl/dummy/DummyViolatedRulesRequest.java index 8727dc3..372e410 100644 --- a/src/test/java/fr/ouestfrance/querydsl/dummy/DummyViolatedRulesRequest.java +++ b/src/test/java/fr/ouestfrance/querydsl/dummy/DummyViolatedRulesRequest.java @@ -1,7 +1,9 @@ package fr.ouestfrance.querydsl.dummy; import fr.ouestfrance.querydsl.FilterField; -import fr.ouestfrance.querydsl.FilterOperation; +import fr.ouestfrance.querydsl.FilterOperation.IN; +import fr.ouestfrance.querydsl.FilterOperation.LTE; +import fr.ouestfrance.querydsl.FilterOperation.LIKE; import lombok.Getter; import lombok.Setter; @@ -11,12 +13,12 @@ @Setter public class DummyViolatedRulesRequest { - @FilterField(operation = FilterOperation.IN) + @FilterField(operation = IN.class) private String code; - @FilterField(operation = FilterOperation.LTE, key = "edition") + @FilterField(operation = LTE.class, key = "edition") private List editions; - @FilterField(operation = FilterOperation.LIKE) + @FilterField(operation = LIKE.class) private int quantity; } diff --git a/src/test/java/fr/ouestfrance/querydsl/service/ext/QueryDslProcessorServiceTest.java b/src/test/java/fr/ouestfrance/querydsl/service/ext/QueryDslProcessorServiceTest.java index d1f2b76..a1cb28c 100644 --- a/src/test/java/fr/ouestfrance/querydsl/service/ext/QueryDslProcessorServiceTest.java +++ b/src/test/java/fr/ouestfrance/querydsl/service/ext/QueryDslProcessorServiceTest.java @@ -17,8 +17,10 @@ class QueryDslProcessorServiceTest { QueryDslProcessorService translatorService = new QueryDslProcessorService<>() { + + @Override - public Mapper getMapper(FilterOperation operation) { + public Mapper getMapper(Class operation) { return new Mapper<>() { @Override public String map(SimpleFilter filterField, Object data) { @@ -26,12 +28,13 @@ public String map(SimpleFilter filterField, Object data) { } @Override - public FilterOperation operation() { - return null; + public Class operation() { + return FilterOperation.EQ.class; } }; } + @Override public String group(List filters, GroupFilter.Operand operand) { return "( " + String.join(" " + operand + " ", filters) + " )"; diff --git a/src/test/java/fr/ouestfrance/querydsl/service/validators/FilterFieldValidatorServiceTest.java b/src/test/java/fr/ouestfrance/querydsl/service/validators/FilterFieldValidatorServiceTest.java index 3b266e3..0890509 100644 --- a/src/test/java/fr/ouestfrance/querydsl/service/validators/FilterFieldValidatorServiceTest.java +++ b/src/test/java/fr/ouestfrance/querydsl/service/validators/FilterFieldValidatorServiceTest.java @@ -15,25 +15,25 @@ class FilterFieldValidatorServiceTest { private final FilterFieldValidatorService validator = new FilterFieldValidatorService(); - static class SampleClass{ + static class SampleClass { List lists; String value; } @SneakyThrows @Test - void shouldSentViolations(){ + void shouldSentViolations() { Optional violations = validator.validate( - new SimpleFilter("test", FilterOperation.EQ, false, SampleClass.class.getDeclaredField("lists"))); + new SimpleFilter("test", FilterOperation.EQ.class, false, SampleClass.class.getDeclaredField("lists"))); assertFalse(violations.isEmpty()); } @SneakyThrows @Test - void shouldValidate(){ + void shouldValidate() { Optional violations = validator.validate( - new SimpleFilter("test", FilterOperation.EQ, false, SampleClass.class.getDeclaredField("value"))); + new SimpleFilter("test", FilterOperation.EQ.class, false, SampleClass.class.getDeclaredField("value"))); assertTrue(violations.isEmpty()); } diff --git a/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/InValidatorTest.java b/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/CollectionValidatorTest.java similarity index 87% rename from src/test/java/fr/ouestfrance/querydsl/service/validators/impl/InValidatorTest.java rename to src/test/java/fr/ouestfrance/querydsl/service/validators/impl/CollectionValidatorTest.java index ab141f4..7b21570 100644 --- a/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/InValidatorTest.java +++ b/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/CollectionValidatorTest.java @@ -1,7 +1,6 @@ package fr.ouestfrance.querydsl.service.validators.impl; import fr.ouestfrance.querydsl.service.validators.FilterFieldValidator; -import fr.ouestfrance.querydsl.service.validators.impl.InValidator; import org.junit.jupiter.api.Test; import java.math.BigDecimal; @@ -11,9 +10,9 @@ import static org.junit.jupiter.api.Assertions.*; -class InValidatorTest { +class CollectionValidatorTest { - private final FilterFieldValidator validator = new InValidator(); + private final FilterFieldValidator validator = new CollectionValidator(); @Test void shouldValidate(){ assertTrue(validator.validate(Set.class)); diff --git a/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/EqualsValidatorTest.java b/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/ComprableValidatorTest.java similarity index 86% rename from src/test/java/fr/ouestfrance/querydsl/service/validators/impl/EqualsValidatorTest.java rename to src/test/java/fr/ouestfrance/querydsl/service/validators/impl/ComprableValidatorTest.java index ba75a12..11e4d8a 100644 --- a/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/EqualsValidatorTest.java +++ b/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/ComprableValidatorTest.java @@ -1,7 +1,6 @@ package fr.ouestfrance.querydsl.service.validators.impl; import fr.ouestfrance.querydsl.service.validators.FilterFieldValidator; -import fr.ouestfrance.querydsl.service.validators.impl.EqualsValidator; import org.junit.jupiter.api.Test; import java.math.BigDecimal; @@ -12,9 +11,9 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -class EqualsValidatorTest { +class ComprableValidatorTest { - private final FilterFieldValidator validator = new EqualsValidator(); + private final FilterFieldValidator validator = new ComparableValidator(); @Test void shouldValidate(){ assertTrue(validator.validate(String.class)); diff --git a/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/GreaterLessValidatorTest.java b/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/GreaterLessValidatorTest.java deleted file mode 100644 index 3fb1e78..0000000 --- a/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/GreaterLessValidatorTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.ouestfrance.querydsl.service.validators.impl; - -import fr.ouestfrance.querydsl.service.validators.FilterFieldValidator; -import fr.ouestfrance.querydsl.service.validators.impl.GreaterLessValidator; -import org.junit.jupiter.api.Test; - -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.*; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -class GreaterLessValidatorTest { - - private final FilterFieldValidator validator = new GreaterLessValidator(); - @Test - void shouldValidate(){ - assertTrue(validator.validate(String.class)); - assertTrue(validator.validate(Double.class)); - assertTrue(validator.validate(LocalDate.class)); - assertTrue(validator.validate(LocalDateTime.class)); - assertTrue(validator.validate(Date.class)); - assertTrue(validator.validate(UUID.class)); - assertTrue(validator.validate(Integer.class)); - assertTrue(validator.validate(BigDecimal.class)); - } - - @Test - void shouldUnValidate(){ - assertFalse(validator.validate(Set.class)); - assertFalse(validator.validate(ArrayList.class)); - assertFalse(validator.validate(LinkedList.class)); - assertFalse(validator.validate(HashSet.class)); - } -} diff --git a/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/LikeValidatorTest.java b/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/StringValidatorTest.java similarity index 87% rename from src/test/java/fr/ouestfrance/querydsl/service/validators/impl/LikeValidatorTest.java rename to src/test/java/fr/ouestfrance/querydsl/service/validators/impl/StringValidatorTest.java index 8593ef5..d2d061e 100644 --- a/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/LikeValidatorTest.java +++ b/src/test/java/fr/ouestfrance/querydsl/service/validators/impl/StringValidatorTest.java @@ -1,7 +1,6 @@ package fr.ouestfrance.querydsl.service.validators.impl; import fr.ouestfrance.querydsl.service.validators.FilterFieldValidator; -import fr.ouestfrance.querydsl.service.validators.impl.LikeValidator; import org.junit.jupiter.api.Test; import java.math.BigDecimal; @@ -12,9 +11,9 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -class LikeValidatorTest { +class StringValidatorTest { - private final FilterFieldValidator validator = new LikeValidator(); + private final FilterFieldValidator validator = new StringValidator(); @Test void shouldValidate(){ assertTrue(validator.validate(String.class));