Browse Source

Upgrade to Assertj 3.17.2

See gh-23179
pull/23184/head
Eddú Meléndez 5 years ago committed by Stephane Nicoll
parent
commit
db8d117d38
  1. 2
      spring-boot-project/spring-boot-dependencies/build.gradle
  2. 2
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java
  3. 18
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/NumberToPeriodConverterTests.java
  4. 42
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/PeriodStyleTests.java

2
spring-boot-project/spring-boot-dependencies/build.gradle

@ -102,7 +102,7 @@ bom { @@ -102,7 +102,7 @@ bom {
]
}
}
library("AssertJ", "3.16.1") {
library("AssertJ", "3.17.2") {
group("org.assertj") {
modules = [
"assertj-core"

2
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java

@ -99,7 +99,7 @@ class ArrayBinderTests { @@ -99,7 +99,7 @@ class ArrayBinderTests {
ResolvableType type = ResolvableType.forArrayComponent(INTEGER_ARRAY.getType());
Bindable<Integer[][]> target = Bindable.of(type);
Integer[][] result = this.binder.bind("foo", target).get();
assertThat(result).hasSize(2);
assertThat(result).hasDimensions(2, 2);
assertThat(result[0]).containsExactly(1, 2);
assertThat(result[1]).containsExactly(3, 4);
}

18
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/NumberToPeriodConverterTests.java

@ -41,21 +41,21 @@ class NumberToPeriodConverterTests { @@ -41,21 +41,21 @@ class NumberToPeriodConverterTests {
@ConversionServiceTest
void convertWhenSimpleWithoutSuffixShouldReturnPeriod(ConversionService conversionService) {
assertThat(convert(conversionService, 10)).isEqualTo(Period.ofDays(10));
assertThat(convert(conversionService, +10)).isEqualTo(Period.ofDays(10));
assertThat(convert(conversionService, -10)).isEqualTo(Period.ofDays(-10));
assertThat(convert(conversionService, 10)).hasDays(10);
assertThat(convert(conversionService, +10)).hasDays(10);
assertThat(convert(conversionService, -10)).hasDays(-10);
}
@ConversionServiceTest
void convertWhenSimpleWithoutSuffixButWithAnnotationShouldReturnPeriod(ConversionService conversionService) {
assertThat(convert(conversionService, 10, ChronoUnit.DAYS)).isEqualTo(Period.ofDays(10));
assertThat(convert(conversionService, -10, ChronoUnit.DAYS)).isEqualTo(Period.ofDays(-10));
assertThat(convert(conversionService, 10, ChronoUnit.DAYS)).hasDays(10);
assertThat(convert(conversionService, -10, ChronoUnit.DAYS)).hasDays(-10);
assertThat(convert(conversionService, 10, ChronoUnit.WEEKS)).isEqualTo(Period.ofWeeks(10));
assertThat(convert(conversionService, -10, ChronoUnit.WEEKS)).isEqualTo(Period.ofWeeks(-10));
assertThat(convert(conversionService, 10, ChronoUnit.MONTHS)).isEqualTo(Period.ofMonths(10));
assertThat(convert(conversionService, -10, ChronoUnit.MONTHS)).isEqualTo(Period.ofMonths(-10));
assertThat(convert(conversionService, 10, ChronoUnit.YEARS)).isEqualTo(Period.ofYears(10));
assertThat(convert(conversionService, -10, ChronoUnit.YEARS)).isEqualTo(Period.ofYears(-10));
assertThat(convert(conversionService, 10, ChronoUnit.MONTHS)).hasMonths(10);
assertThat(convert(conversionService, -10, ChronoUnit.MONTHS)).hasMonths(-10);
assertThat(convert(conversionService, 10, ChronoUnit.YEARS)).hasYears(10);
assertThat(convert(conversionService, -10, ChronoUnit.YEARS)).hasYears(-10);
}
private Period convert(ConversionService conversionService, Integer source) {

42
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/PeriodStyleTests.java

@ -50,10 +50,10 @@ class PeriodStyleTests { @@ -50,10 +50,10 @@ class PeriodStyleTests {
@Test
void detectAndParseWhenSimpleDaysShouldReturnPeriod() {
assertThat(PeriodStyle.detectAndParse("10d")).isEqualTo(Period.ofDays(10));
assertThat(PeriodStyle.detectAndParse("10D")).isEqualTo(Period.ofDays(10));
assertThat(PeriodStyle.detectAndParse("+10d")).isEqualTo(Period.ofDays(10));
assertThat(PeriodStyle.detectAndParse("-10D")).isEqualTo(Period.ofDays(-10));
assertThat(PeriodStyle.detectAndParse("10d")).hasDays(10);
assertThat(PeriodStyle.detectAndParse("10D")).hasDays(10);
assertThat(PeriodStyle.detectAndParse("+10d")).hasDays(10);
assertThat(PeriodStyle.detectAndParse("-10D")).hasDays(-10);
}
@Test
@ -66,32 +66,32 @@ class PeriodStyleTests { @@ -66,32 +66,32 @@ class PeriodStyleTests {
@Test
void detectAndParseWhenSimpleMonthsShouldReturnPeriod() {
assertThat(PeriodStyle.detectAndParse("10m")).isEqualTo(Period.ofMonths(10));
assertThat(PeriodStyle.detectAndParse("10M")).isEqualTo(Period.ofMonths(10));
assertThat(PeriodStyle.detectAndParse("+10m")).isEqualTo(Period.ofMonths(10));
assertThat(PeriodStyle.detectAndParse("-10M")).isEqualTo(Period.ofMonths(-10));
assertThat(PeriodStyle.detectAndParse("10m")).hasMonths(10);
assertThat(PeriodStyle.detectAndParse("10M")).hasMonths(10);
assertThat(PeriodStyle.detectAndParse("+10m")).hasMonths(10);
assertThat(PeriodStyle.detectAndParse("-10M")).hasMonths(-10);
}
@Test
void detectAndParseWhenSimpleYearsShouldReturnPeriod() {
assertThat(PeriodStyle.detectAndParse("10y")).isEqualTo(Period.ofYears(10));
assertThat(PeriodStyle.detectAndParse("10Y")).isEqualTo(Period.ofYears(10));
assertThat(PeriodStyle.detectAndParse("+10y")).isEqualTo(Period.ofYears(10));
assertThat(PeriodStyle.detectAndParse("-10Y")).isEqualTo(Period.ofYears(-10));
assertThat(PeriodStyle.detectAndParse("10y")).hasYears(10);
assertThat(PeriodStyle.detectAndParse("10Y")).hasYears(10);
assertThat(PeriodStyle.detectAndParse("+10y")).hasYears(10);
assertThat(PeriodStyle.detectAndParse("-10Y")).hasYears(-10);
}
@Test
void detectAndParseWhenSimpleWithoutSuffixShouldReturnPeriod() {
assertThat(PeriodStyle.detectAndParse("10")).isEqualTo(Period.ofDays(10));
assertThat(PeriodStyle.detectAndParse("+10")).isEqualTo(Period.ofDays(10));
assertThat(PeriodStyle.detectAndParse("-10")).isEqualTo(Period.ofDays(-10));
assertThat(PeriodStyle.detectAndParse("10")).hasDays(10);
assertThat(PeriodStyle.detectAndParse("+10")).hasDays(10);
assertThat(PeriodStyle.detectAndParse("-10")).hasDays(-10);
}
@Test
void detectAndParseWhenSimpleWithoutSuffixButWithChronoUnitShouldReturnPeriod() {
assertThat(PeriodStyle.detectAndParse("10", ChronoUnit.MONTHS)).isEqualTo(Period.ofMonths(10));
assertThat(PeriodStyle.detectAndParse("+10", ChronoUnit.MONTHS)).isEqualTo(Period.ofMonths(10));
assertThat(PeriodStyle.detectAndParse("-10", ChronoUnit.MONTHS)).isEqualTo(Period.ofMonths(-10));
assertThat(PeriodStyle.detectAndParse("10", ChronoUnit.MONTHS)).hasMonths(10);
assertThat(PeriodStyle.detectAndParse("+10", ChronoUnit.MONTHS)).hasMonths(10);
assertThat(PeriodStyle.detectAndParse("-10", ChronoUnit.MONTHS)).hasMonths(-10);
}
@Test
@ -168,13 +168,13 @@ class PeriodStyleTests { @@ -168,13 +168,13 @@ class PeriodStyleTests {
@Test
void parseSimpleShouldParse() {
assertThat(PeriodStyle.SIMPLE.parse("10m")).isEqualTo(Period.ofMonths(10));
assertThat(PeriodStyle.SIMPLE.parse("10m")).hasMonths(10);
}
@Test
void parseSimpleWithUnitShouldUseUnitAsFallback() {
assertThat(PeriodStyle.SIMPLE.parse("10m", ChronoUnit.DAYS)).isEqualTo(Period.ofMonths(10));
assertThat(PeriodStyle.SIMPLE.parse("10", ChronoUnit.MONTHS)).isEqualTo(Period.ofMonths(10));
assertThat(PeriodStyle.SIMPLE.parse("10m", ChronoUnit.DAYS)).hasMonths(10);
assertThat(PeriodStyle.SIMPLE.parse("10", ChronoUnit.MONTHS)).hasMonths(10);
}
@Test

Loading…
Cancel
Save