Skip to content

Commit 3f0526d

Browse files
committed
Update library and fix issue in documentation
1 parent ecbd6ad commit 3f0526d

File tree

13 files changed

+55
-44
lines changed

13 files changed

+55
-44
lines changed

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ There are various ways to contribute to this repository. You can help us out by:
6464
* Log issues in the github issue tracker
6565
* Send a Pull-Request
6666

67-
If you would like to contribute code, please read the [`How to Contribute`](https://sddevelopment-be.github.io/modular-validators/CONTRIBUTING.html) guide included in the repository.
67+
If you would like to contribute code, please read the [`How to Contribute`](./CONTRIBUTING.md) guide included in the repository.
6868

6969
## Contributors
7070

docs/apidocs/be/sddevelopment/validation/core/class-use/Constrainable.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!DOCTYPE HTML>
22
<html lang="en">
33
<head>
4-
<!-- Generated by javadoc (21) on Thu Dec 28 13:49:11 UTC 2023 -->
5-
<title>Uses of Class be.sddevelopment.validation.core.Constrainable (modular-validators 1.0.0-SNAPSHOT API)</title>
4+
<!-- Generated by javadoc (21) on Thu Dec 28 12:22:54 UTC 2023 -->
5+
<title>Uses of Class be.sddevelopment.validation.core.Constrained (modular-validators 1.0.0-SNAPSHOT API)</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
88
<meta name="dc.created" content="2023-12-28">
@@ -49,7 +49,7 @@
4949
<div class="flex-content">
5050
<main role="main">
5151
<div class="header">
52-
<h1 title="Uses of Class be.sddevelopment.validation.core.Constrainable" class="title">Uses of Class<br>be.sddevelopment.validation.core.Constrainable</h1>
52+
<h1 title="Uses of Class be.sddevelopment.validation.core.Constrained" class="title">Uses of Class<br>be.sddevelopment.validation.core.Constrained</h1>
5353
</div>
5454
<section class="class-uses">
5555
<ul class="block-list">

pom.xml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
<encoding>UTF-8</encoding>
2929
<reportOutputDirectory>${project.basedir}/docs/</reportOutputDirectory>
3030

31-
<archunit.version>1.2.1</archunit.version>
32-
<junit.jupiter.version>5.10.0</junit.jupiter.version>
31+
<archunit.version>1.3.0</archunit.version>
32+
<junit.jupiter.version>5.11.0</junit.jupiter.version>
33+
<assertj.version>3.26.3</assertj.version>
3334
<jacoco.build.dir>${project.build.directory}/jacoco</jacoco.build.dir>
3435

3536
<sonar.organization>sddevelopment-be</sonar.organization>
@@ -72,20 +73,20 @@
7273
<dependency>
7374
<groupId>org.assertj</groupId>
7475
<artifactId>assertj-core</artifactId>
75-
<version>3.23.1</version>
76+
<version>${assertj.version}</version>
7677
<scope>test</scope>
7778
</dependency>
78-
<dependency>
79-
<groupId>org.apache.commons</groupId>
80-
<artifactId>commons-lang3</artifactId>
81-
<version>3.14.0</version>
82-
</dependency>
8379
<dependency>
8480
<groupId>org.mockito</groupId>
8581
<artifactId>mockito-junit-jupiter</artifactId>
86-
<version>5.8.0</version>
82+
<version>5.12.0</version>
8783
<scope>test</scope>
8884
</dependency>
85+
<dependency>
86+
<groupId>org.apache.commons</groupId>
87+
<artifactId>commons-lang3</artifactId>
88+
<version>3.14.0</version>
89+
</dependency>
8990
<dependency>
9091
<groupId>net.bytebuddy</groupId>
9192
<artifactId>byte-buddy</artifactId>
@@ -110,7 +111,18 @@
110111
<version>${archunit.version}</version>
111112
<scope>test</scope>
112113
</dependency>
113-
114+
<dependency>
115+
<groupId>com.tngtech.archunit</groupId>
116+
<artifactId>archunit-junit5-engine</artifactId>
117+
<version>${archunit.version}</version>
118+
<scope>test</scope>
119+
</dependency>
120+
<dependency>
121+
<groupId>com.google.guava</groupId>
122+
<artifactId>guava</artifactId>
123+
<version>33.3.0-jre</version>
124+
</dependency>
125+
114126
<!-- END TEST SCOPE -->
115127

116128
</dependencies>
@@ -211,6 +223,7 @@
211223
<addStylesheets>
212224
<resources>${project.basedir}/javadoc/stylesheet.css</resources>
213225
</addStylesheets>
226+
<encoding>${encoding}</encoding>
214227
</configuration>
215228
<reportSets>
216229
<reportSet>

src/main/java/be/sddevelopment/validation/core/Constrainable.java renamed to src/main/java/be/sddevelopment/validation/core/Constrained.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
* @author Stijn Dejongh
1818
* @version 1.0.0-SNAPSHOT
1919
*/
20-
public final class Constrainable<T> {
20+
public final class Constrained<T> {
2121

2222
private final T data;
2323
private final ModularRuleset<T> toAdhereTo;
2424

25-
private Constrainable(T toValidate, ModularRuleset<T> toAdhereTo) {
25+
private Constrained(T toValidate, ModularRuleset<T> toAdhereTo) {
2626
this.data = toValidate;
2727
this.toAdhereTo = toAdhereTo;
2828
}
@@ -31,20 +31,20 @@ public boolean isValid() {
3131
return this.toAdhereTo.quickCheck(this.data).isPassing();
3232
}
3333

34-
Constrainable<T> adheresTo(Constraint<T> constraint) {
35-
return new Constrainable<>(this.data, this.toAdhereTo.toBuilder().must(constraint).done());
34+
public Constrained<T> adheresTo(Constraint<T> constraint) {
35+
return new Constrained<>(this.data, this.toAdhereTo.toBuilder().must(constraint).done());
3636
}
3737

38-
public static <T> Constrainable<T> constrain(T toConstrain) {
38+
public static <T> Constrained<T> constrain(T toConstrain) {
3939
return constrain(toConstrain, emptyRules());
4040
}
4141

42-
public static <T> Constrainable<T> constrain(T toConstrain, ModularRuleset<T> ruleset) {
42+
public static <T> Constrained<T> constrain(T toConstrain, ModularRuleset<T> ruleset) {
4343
return of(toConstrain, ruleset);
4444
}
4545

46-
public static <T> Constrainable<T> of(T toConstrain, ModularRuleset<T> ruleset) {
47-
return new Constrainable<>(toConstrain, ruleset);
46+
public static <T> Constrained<T> of(T toConstrain, ModularRuleset<T> ruleset) {
47+
return new Constrained<>(toConstrain, ruleset);
4848
}
4949

5050
public Rationale rationale() {
@@ -65,7 +65,7 @@ public void guard() throws InvalidObjectException {
6565
}
6666
}
6767

68-
public <R> Constrainable<R> extract(Function<T, R> extractor) {
68+
public <R> Constrained<R> extract(Function<T, R> extractor) {
6969
return constrain(extractor.apply(this.data), emptyRules());
7070
}
7171

src/main/java/be/sddevelopment/validation/core/Constraints.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@
22

33
import org.apache.commons.lang3.StringUtils;
44

5-
import java.util.Objects;
6-
import java.util.function.Function;
7-
import java.util.function.Predicate;
8-
9-
import static java.util.function.Predicate.not;
10-
115
/**
126
* <p>Utility class, used allow for a more straight-forward configuration of {@link ModularRuleset} constructs</p>
137
*/
148
public final class Constraints {
159
private Constraints() {
1610
throw new UnsupportedOperationException("Utility classes (containing shared methods or constants) should not be instantiated.");
1711
}
12+
1813
public static final Constraint<String> IS_NOT_EMPTY = new Constraint<>(StringUtils::isNotBlank, "mustn't be blank");
14+
1915
public static Constraint<String> isNotEmpty() {
2016
return IS_NOT_EMPTY;
2117
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package be.sddevelopment.validation.core;
2+
23
public enum Evaluation {
34
PASS, FAIL
45
}

src/main/java/be/sddevelopment/validation/core/ModularRuleset.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ private ModularRuleset(List<Constraint<T>> rules) {
1414
this.rules.addAll(rules);
1515
}
1616

17-
public Constrainable<T> constrain(T toValidate) {
18-
return Constrainable.of(toValidate, this);
17+
public Constrained<T> constrain(T toValidate) {
18+
return Constrained.of(toValidate, this);
1919
}
2020

2121
public Rationale assess(T toValidate) {

src/main/java/be/sddevelopment/validation/core/Rationale.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ public boolean isPassing() {
3939
public boolean isFailing() {
4040
return !this.isPassing();
4141
}
42+
4243
}

src/main/java/be/sddevelopment/validation/core/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* <p>
33
* Contains the core classes of the modular validation framework.
4-
* The most notable entries are {@link be.sddevelopment.validation.core.Constrainable} and {@link be.sddevelopment.validation.core.ModularRuleset}.
4+
* The most notable entries are {@link be.sddevelopment.validation.core.Constrained} and {@link be.sddevelopment.validation.core.ModularRuleset}.
55
* </p>
66
* <p>These classes are the building blocks of the framework, and are used to create the validation rules.</p>
77
*/

src/test/java/be/sddevelopment/validation/CheckedTestUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package be.sddevelopment.validation;
22

3-
import be.sddevelopment.validation.core.Constrainable;
3+
import be.sddevelopment.validation.core.Constrained;
44
import be.sddevelopment.validation.core.Reason;
55
import org.assertj.core.api.Condition;
66

@@ -12,12 +12,12 @@ public final class CheckedTestUtils {
1212
// throw new IllegalAccessException("Utility classes (containing shared methods or constants) should not be instantiated.");
1313
// }
1414

15-
public static Condition<Constrainable<?>> valid() {
16-
return new Condition<>(Constrainable::isValid, "valid");
15+
public static Condition<Constrained<?>> valid() {
16+
return new Condition<>(Constrained::isValid, "valid");
1717
}
1818

19-
public static Condition<Constrainable<?>> invalid() {
20-
return new Condition<>(Predicate.not(Constrainable::isValid), "invalid");
19+
public static Condition<Constrained<?>> invalid() {
20+
return new Condition<>(Predicate.not(Constrained::isValid), "invalid");
2121
}
2222

2323
public static Condition<Reason> passing() {

0 commit comments

Comments
 (0)