Skip to content

Commit c4aa3f3

Browse files
committed
First implementation of validation spec parsing -- WIP
1 parent 8ce0daf commit c4aa3f3

File tree

13 files changed

+188
-94
lines changed

13 files changed

+188
-94
lines changed

core/pom.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<parent>
8-
<groupId>be.sddevelopment</groupId>
8+
<groupId>be.sddevelopment.validation</groupId>
99
<artifactId>modular-validators</artifactId>
1010
<version>1.1.0-SNAPSHOT</version>
1111
<relativePath>../pom.xml</relativePath>
@@ -15,6 +15,22 @@
1515

1616

1717
<dependencies>
18+
<dependency>
19+
<groupId>be.sddevelopment.commons</groupId>
20+
<artifactId>commons-kernel</artifactId>
21+
</dependency>
22+
<dependency>
23+
<groupId>be.sddevelopment.commons</groupId>
24+
<artifactId>commons</artifactId>
25+
</dependency>
26+
27+
<!-- BEGIN TEST SCOPE -->
28+
<dependency>
29+
<groupId>be.sddevelopment.commons</groupId>
30+
<artifactId>commons-testing</artifactId>
31+
<scope>test</scope>
32+
</dependency>
33+
1834
<!-- BEGIN TEST SCOPE -->
1935
<dependency>
2036
<groupId>org.junit.jupiter</groupId>

core/src/test/java/be/sddevelopment/validation/core/ConstrainedTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package be.sddevelopment.validation.core;
22

3+
import be.sddevelopment.commons.testing.naming.ReplaceUnderscoredCamelCasing;
34
import org.assertj.core.api.WithAssertions;
45
import org.junit.jupiter.api.DisplayName;
6+
import org.junit.jupiter.api.DisplayNameGeneration;
57
import org.junit.jupiter.api.Test;
68
import org.junit.jupiter.api.extension.ExtendWith;
79
import org.junit.platform.commons.util.StringUtils;
@@ -21,6 +23,7 @@
2123

2224
@DisplayName("Constrainables")
2325
@ExtendWith({MockitoExtension.class})
26+
@DisplayNameGeneration(ReplaceUnderscoredCamelCasing.class)
2427
class ConstrainedTest implements WithAssertions {
2528

2629
@Test

core/src/test/java/be/sddevelopment/validation/core/ConstraintTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package be.sddevelopment.validation.core;
22

3+
import be.sddevelopment.commons.testing.naming.ReplaceUnderscoredCamelCasing;
34
import be.sddevelopment.validation.CheckedTestUtils;
45
import org.assertj.core.api.WithAssertions;
56
import org.junit.jupiter.api.DisplayName;
7+
import org.junit.jupiter.api.DisplayNameGeneration;
68
import org.junit.jupiter.api.Test;
79
import org.junit.platform.commons.util.StringUtils;
810

@@ -14,6 +16,7 @@
1416
import static be.sddevelopment.validation.core.Reason.passed;
1517

1618
@DisplayName("Constraints / Rules")
19+
@DisplayNameGeneration(ReplaceUnderscoredCamelCasing.class)
1720
class ConstraintTest implements WithAssertions {
1821

1922
@Test

core/src/test/java/be/sddevelopment/validation/core/ContrainsTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package be.sddevelopment.validation.core;
22

3+
import be.sddevelopment.commons.testing.naming.ReplaceUnderscoredCamelCasing;
34
import org.assertj.core.api.WithAssertions;
45
import org.junit.jupiter.api.DisplayName;
6+
import org.junit.jupiter.api.DisplayNameGeneration;
57
import org.junit.jupiter.api.Test;
68

79
import static be.sddevelopment.validation.core.Checks.haveNonNullField;
810

911
@DisplayName("Constraints utility class")
12+
@DisplayNameGeneration(ReplaceUnderscoredCamelCasing.class)
1013
class ContrainsTest implements WithAssertions {
1114

1215
@Test

core/src/test/java/be/sddevelopment/validation/core/InvalidObjectExceptionTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package be.sddevelopment.validation.core;
22

3+
import be.sddevelopment.commons.testing.naming.ReplaceUnderscoredCamelCasing;
34
import org.assertj.core.api.WithAssertions;
45
import org.junit.jupiter.api.DisplayName;
6+
import org.junit.jupiter.api.DisplayNameGeneration;
57
import org.junit.jupiter.api.Test;
68

79
import static be.sddevelopment.validation.core.Reason.failed;
810
import static be.sddevelopment.validation.core.Reason.passed;
911

1012
@DisplayName("InvalidObject Exceptions")
13+
@DisplayNameGeneration(ReplaceUnderscoredCamelCasing.class)
1114
class InvalidObjectExceptionTest implements WithAssertions {
1215

1316
@Test

core/src/test/java/be/sddevelopment/validation/specs/code_quality/CodeConventionsTest.java

Lines changed: 0 additions & 86 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package be.sddevelopment.validation.specs.code_quality;
2+
3+
import be.sddevelopment.commons.testing.conventions.CodeConventions;
4+
import be.sddevelopment.commons.testing.naming.ReplaceUnderscoredCamelCasing;
5+
import com.tngtech.archunit.core.domain.JavaClass;
6+
import com.tngtech.archunit.core.domain.JavaClasses;
7+
import com.tngtech.archunit.core.domain.JavaConstructor;
8+
import com.tngtech.archunit.junit.AnalyzeClasses;
9+
import com.tngtech.archunit.junit.ArchTest;
10+
import com.tngtech.archunit.lang.ArchCondition;
11+
import com.tngtech.archunit.lang.ArchRule;
12+
import com.tngtech.archunit.lang.ConditionEvents;
13+
import org.assertj.core.api.WithAssertions;
14+
import org.junit.jupiter.api.DisplayName;
15+
import org.junit.jupiter.api.DisplayNameGeneration;
16+
17+
import java.lang.reflect.InvocationTargetException;
18+
import java.util.List;
19+
20+
import static com.tngtech.archunit.core.domain.JavaModifier.FINAL;
21+
import static com.tngtech.archunit.lang.SimpleConditionEvent.satisfied;
22+
import static com.tngtech.archunit.lang.SimpleConditionEvent.violated;
23+
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
24+
import static com.tngtech.archunit.library.GeneralCodingRules.*;
25+
import static org.junit.platform.commons.util.ReflectionUtils.makeAccessible;
26+
27+
@DisplayName("Complies with code conventions")
28+
@AnalyzeClasses(packages = "be.sddevelopment.validation.core")
29+
public class ConventionsAdherenceTests implements CodeConventions {
30+
31+
/* This class can be empty, it is used to run the test of its parent interface
32+
* CodeConventions. This interface contains the tests for the code conventions,
33+
* and will execute them based on the {@code @AnalyzeClasses} annotation.
34+
*/
35+
36+
}

core/src/test/java/be/sddevelopment/validation/specs/usage/BasicUsageTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package be.sddevelopment.validation.specs.usage;
22

3+
import be.sddevelopment.commons.testing.naming.ReplaceUnderscoredCamelCasing;
34
import be.sddevelopment.validation.core.*;
45
import org.assertj.core.api.WithAssertions;
56
import org.junit.jupiter.api.DisplayName;
7+
import org.junit.jupiter.api.DisplayNameGeneration;
68
import org.junit.jupiter.api.Nested;
79
import org.junit.jupiter.api.Test;
810

@@ -23,6 +25,7 @@
2325
import static org.apache.commons.lang3.StringUtils.containsIgnoreCase;
2426

2527
@DisplayName("Basic Usage")
28+
@DisplayNameGeneration(ReplaceUnderscoredCamelCasing.class)
2629
class BasicUsageTest implements WithAssertions {
2730

2831
@Nested

dsl/pom.xml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<parent>
8-
<groupId>be.sddevelopment</groupId>
8+
<groupId>be.sddevelopment.validation</groupId>
99
<artifactId>modular-validators</artifactId>
1010
<version>1.1.0-SNAPSHOT</version>
1111
<relativePath>../pom.xml</relativePath>
@@ -26,11 +26,24 @@
2626

2727
<dependencies>
2828
<dependency>
29-
<groupId>be.sddevelopment</groupId>
29+
<groupId>be.sddevelopment.validation</groupId>
3030
<artifactId>core</artifactId>
3131
</dependency>
32+
<dependency>
33+
<groupId>be.sddevelopment.commons</groupId>
34+
<artifactId>commons-kernel</artifactId>
35+
</dependency>
36+
<dependency>
37+
<groupId>be.sddevelopment.commons</groupId>
38+
<artifactId>commons</artifactId>
39+
</dependency>
3240

3341
<!-- BEGIN TEST SCOPE -->
42+
<dependency>
43+
<groupId>be.sddevelopment.commons</groupId>
44+
<artifactId>commons-testing</artifactId>
45+
<scope>test</scope>
46+
</dependency>
3447
<dependency>
3548
<groupId>org.junit.jupiter</groupId>
3649
<artifactId>junit-jupiter-api</artifactId>
@@ -51,6 +64,21 @@
5164
<artifactId>mockito-junit-jupiter</artifactId>
5265
<scope>test</scope>
5366
</dependency>
67+
<dependency>
68+
<groupId>com.tngtech.archunit</groupId>
69+
<artifactId>archunit</artifactId>
70+
<scope>test</scope>
71+
</dependency>
72+
<dependency>
73+
<groupId>com.tngtech.archunit</groupId>
74+
<artifactId>archunit-junit5</artifactId>
75+
<scope>test</scope>
76+
</dependency>
77+
<dependency>
78+
<groupId>com.tngtech.archunit</groupId>
79+
<artifactId>archunit-junit5-engine</artifactId>
80+
<scope>test</scope>
81+
</dependency>
5482
</dependencies>
5583

5684

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package be.sddevelopment.validation.dsl;
2+
3+
import be.sddevelopment.commons.access.AccessProtectionUtils;
4+
import be.sddevelopment.commons.annotations.Utility;
5+
import be.sddevelopment.validation.core.ModularRuleset;
6+
7+
import java.nio.file.Path;
8+
9+
import static be.sddevelopment.commons.access.AccessProtectionUtils.utilityClassConstructor;
10+
11+
@Utility
12+
public final class ValidatorParser {
13+
14+
private ValidatorParser() {
15+
utilityClassConstructor();
16+
}
17+
18+
public static ModularRuleset fromSpecification(Path validationSpec) {
19+
return null;
20+
}
21+
}

0 commit comments

Comments
 (0)