Skip to content

Commit 373386c

Browse files
committed
Improve test readability
1 parent 63100f8 commit 373386c

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
<plugin>
151151
<groupId>org.apache.maven.plugins</groupId>
152152
<artifactId>maven-compiler-plugin</artifactId>
153-
<version>3.11.0</version>
153+
<version>3.13.0</version>
154154
<configuration>
155155
<source>${java.version}</source>
156156
<target>${java.version}</target>
@@ -185,7 +185,7 @@
185185
<plugin>
186186
<groupId>org.jacoco</groupId>
187187
<artifactId>jacoco-maven-plugin</artifactId>
188-
<version>0.8.10</version>
188+
<version>0.8.12</version>
189189
<executions>
190190
<execution>
191191
<goals>

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

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

3-
import be.sddevelopment.validation.core.Constraint;
4-
import be.sddevelopment.validation.core.InvalidObjectException;
5-
import be.sddevelopment.validation.core.ModularRuleset;
3+
import be.sddevelopment.validation.core.*;
64
import org.assertj.core.api.WithAssertions;
75
import org.junit.jupiter.api.DisplayName;
86
import org.junit.jupiter.api.Nested;
@@ -39,8 +37,12 @@ void modularValidatorsMustCoverBasicUsage_givenSimpleDateBasedValidationLogic()
3937
.must(notBeNull)
4038
.must(haveNonNullField(DateBasedDummyObject::localDate), "have a non-null local date")
4139
.iHaveSpoken();
40+
Constrained<DateBasedDummyObject> constrained = validator.constrain(toValidate);
4241

43-
assertThat(validator.constrain(toValidate)).is(valid());
42+
assertThat(constrained).is(valid());
43+
assertThat(constrained)
44+
.extracting(Constrained::rationale)
45+
.matches(Rationale::isPassing);
4446
}
4547

4648
private record DateBasedDummyObject(LocalDate localDate) {
@@ -77,10 +79,10 @@ void checkedShouldAllowForFluentUsage_whenUsingItAsAGuard_givenInvalidObject() {
7779

7880
@Test
7981
void allowsForFurtherProcessing() {
80-
var toBeUsed = new DateBasedDummyObject("I have a name", LocalDate.of(2023, MARCH, 9));
8182
var dateLoggingService = new DateLoggingService();
82-
assertThat(requirements().constrain(toBeUsed)).is(valid());
8383
assertThat(dateLoggingService.logLines()).isEmpty();
84+
var toBeUsed = new DateBasedDummyObject("I have a name", LocalDate.of(2023, MARCH, 9));
85+
assertThat(requirements().constrain(toBeUsed)).is(valid());
8486

8587
requirements().constrain(toBeUsed)
8688
.extract(DateBasedDummyObject::localDate)

0 commit comments

Comments
 (0)