Skip to content

Commit

Permalink
Adapt time module tests to work with assertJ 3.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jlink committed May 27, 2024
1 parent bd064bf commit b8eb1c9
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ ext {
apiGuardianVersion = '1.1.2'
opentest4jVersion = '1.3.0'
archunitVersion = '1.3.0'
assertJVersion = '3.25.3'
assertJVersion = '3.26.0'
mockitoVersion = '4.11.0'
systemLambdaVersion = '1.2.1'
kotlinVersion = '1.9.22'
kotlinVersion = '1.9.22' // TODO: Support version 2.x
kotlinxVersion = '1.8.1'
kotestVersion = '5.9.0'
findbugsVersion = '3.0.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Constraints {
void yearRangeBetweenMinus100And100(@ForAll @YearRange(min = -100, max = 100) Year year) {
assertThat(year.getValue()).isGreaterThanOrEqualTo(-100);
assertThat(year.getValue()).isLessThanOrEqualTo(100);
assertThat(year).isNotEqualTo(Year.of(0));
assertThat((Object) year).isNotEqualTo(Year.of(0));
}

@Property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class DefaultGenerationTests {

@Property
void yearIsNotNull(@ForAll Year year) {
assertThat(year).isNotNull();
assertThat((Object) year).isNotNull();
}

@Property
Expand All @@ -21,7 +21,7 @@ void defaultYearGenerationYearsOnlyBetween1900And2500(@ForAll Year year) {

@Property
void yearIsNotZero(@ForAll Year year) {
assertThat(year).isNotEqualTo(Year.of(0));
assertThat((Object) year).isNotEqualTo(Year.of(0));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public class ShrinkingTests {
void defaultShrinking(@ForAll Random random) {
YearArbitrary years = Dates.years();
Year value = falsifyThenShrink(years, random);
assertThat(value).isEqualTo(Year.of(1900));
assertThat((Object) value).isEqualTo(Year.of(1900));
}

@Property
void shrinksToSmallestFailingPositiveValue(@ForAll Random random) {
YearArbitrary years = Dates.years();
TestingFalsifier<Year> falsifier = year -> year.getValue() < 1942;
Year value = falsifyThenShrink(years, random, falsifier);
assertThat(value).isEqualTo(Year.of(1942));
assertThat((Object) value).isEqualTo(Year.of(1942));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Arbitrary<Year> yearsAround0() {

@Property
void yearIsNotNull(@ForAll("years") Year year) {
assertThat(year).isNotNull();
assertThat((Object) year).isNotNull();
}

@Property
Expand All @@ -32,7 +32,7 @@ void defaultYearGenerationYearsOnlyBetween1900And2500(@ForAll("years") Year year

@Property
void yearIsNotZero(@ForAll("yearsAround0") Year year) {
assertThat(year).isNotEqualTo(Year.of(0));
assertThat((Object) year).isNotEqualTo(Year.of(0));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ void between(@ForAll("years") Year startYear, @ForAll("years") Year endYear, @Fo
Arbitrary<Year> years = Dates.years().between(startYear, endYear);

checkAllGenerated(years.generator(1000, true), random, year -> {
assertThat(year).isGreaterThanOrEqualTo(startYear);
assertThat(year).isLessThanOrEqualTo(endYear);
assertThat(year.getValue()).isGreaterThanOrEqualTo(startYear.getValue());
assertThat(year.getValue()).isLessThanOrEqualTo(endYear.getValue());
return true;
});

Expand All @@ -38,7 +38,7 @@ void betweenSame(@ForAll("years") Year year, @ForAll Random random) {
Arbitrary<Year> years = Dates.years().between(year, year);

checkAllGenerated(years.generator(1000, true), random, y -> {
assertThat(y).isEqualTo(year);
assertThat((Object) y).isEqualTo(year);
return true;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Constraints {

@Property
void yearMonthRangeBetween(@ForAll @YearMonthRange(min = "2013-05", max = "2020-08") YearMonth yearMonth) {
assertThat(yearMonth).isGreaterThanOrEqualTo(YearMonth.of(2013, MAY));
assertThat(yearMonth).isLessThanOrEqualTo(YearMonth.of(2020, AUGUST));
assertThat(yearMonth).isAfterOrEqualTo(YearMonth.of(2013, MAY));
assertThat(yearMonth).isBeforeOrEqualTo(YearMonth.of(2020, AUGUST));
}

@Property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void atTheEarliest(@ForAll("yearMonths") YearMonth yearMonth, @ForAll Random ran
Arbitrary<YearMonth> yearMonths = Dates.yearMonths().atTheEarliest(yearMonth);

checkAllGenerated(yearMonths.generator(1000, true), random, ym -> {
assertThat(ym).isGreaterThanOrEqualTo(yearMonth);
assertThat(ym).isAfterOrEqualTo(yearMonth);
return true;
});

Expand All @@ -47,8 +47,8 @@ void atTheEarliestAtTheLatestMinAfterMax(
Arbitrary<YearMonth> yearMonths = Dates.yearMonths().atTheEarliest(min).atTheLatest(max);

checkAllGenerated(yearMonths.generator(1000, true), random, ym -> {
assertThat(ym).isGreaterThanOrEqualTo(max);
assertThat(ym).isLessThanOrEqualTo(min);
assertThat(ym).isAfterOrEqualTo(max);
assertThat(ym).isBeforeOrEqualTo(min);
return true;
});

Expand All @@ -60,7 +60,7 @@ void atTheLatest(@ForAll("yearMonths") YearMonth yearMonth, @ForAll Random rando
Arbitrary<YearMonth> yearMonths = Dates.yearMonths().atTheLatest(yearMonth);

checkAllGenerated(yearMonths.generator(1000, true), random, ym -> {
assertThat(ym).isLessThanOrEqualTo(yearMonth);
assertThat(ym).isBeforeOrEqualTo(yearMonth);
return true;
});

Expand All @@ -78,8 +78,8 @@ void atTheLatestAtTheEarliestMinAfterMax(
Arbitrary<YearMonth> yearMonths = Dates.yearMonths().atTheLatest(max).atTheEarliest(min);

checkAllGenerated(yearMonths.generator(1000, true), random, ym -> {
assertThat(ym).isGreaterThanOrEqualTo(max);
assertThat(ym).isLessThanOrEqualTo(min);
assertThat(ym).isAfterOrEqualTo(max);
assertThat(ym).isBeforeOrEqualTo(min);
return true;
});

Expand All @@ -97,8 +97,8 @@ void between(
Arbitrary<YearMonth> yearMonths = Dates.yearMonths().between(startYearMonth, endYearMonth);

checkAllGenerated(yearMonths.generator(1000, true), random, ym -> {
assertThat(ym).isGreaterThanOrEqualTo(startYearMonth);
assertThat(ym).isLessThanOrEqualTo(endYearMonth);
assertThat(ym).isAfterOrEqualTo(startYearMonth);
assertThat(ym).isBeforeOrEqualTo(endYearMonth);
return true;
});
}
Expand Down

0 comments on commit b8eb1c9

Please sign in to comment.