Skip to content

Commit c849358

Browse files
committed
Adjust for 3.x
1 parent 390ccd6 commit c849358

6 files changed

Lines changed: 41 additions & 37 deletions

assertj-core/src/test/java/org/assertj/core/api/SoftAssertions_future_Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ void should_not_collect_AssertionError_from_CompletableFuture_isCompletedWithVal
118118
CompletableFuture<String> future = new CompletableFuture<>();
119119
future.cancel(false);
120120
// WHEN
121-
var assertionError = expectAssertionError(() -> softly.assertThat(future)
122-
.isCompletedWithValueMatchingWithin(Predicate.isEqual("test"),
123-
TEN_MILLIS));
121+
AssertionError assertionError = expectAssertionError(() -> softly.assertThat(future)
122+
.isCompletedWithValueMatchingWithin(Predicate.isEqual("test"),
123+
TEN_MILLIS));
124124
// THEN
125125
assertThat(softly.errorsCollected()).isEmpty();
126126
assertThat(assertionError).hasMessageContaining("Cancelled");

assertj-core/src/test/java/org/assertj/core/api/future/CompletableFutureAssert_isCompletedWithValueMatchingWithin_Test.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ void should_fail_on_pending_future_that_will_complete_in_provided_period_but_wit
7878
// GIVEN
7979
CompletableFuture<String> future = completedFutureAfter("string", TEN_MS, executorService);
8080
// WHEN
81-
var assertionError = expectAssertionError(() -> assertThat(future).isCompletedWithValueMatchingWithin(s -> s.length() == 5,
82-
FIFTY_MS));
81+
AssertionError assertionError = expectAssertionError(() -> assertThat(future).isCompletedWithValueMatchingWithin(s -> s.length() == 5,
82+
FIFTY_MS));
8383
// THEN
8484
then(assertionError).hasMessageContaining("to match given predicate");
8585
}
@@ -89,10 +89,10 @@ void should_fail_with_custom_description() {
8989
// GIVEN
9090
CompletableFuture<String> future = completedFutureAfter("string", TEN_MS, executorService);
9191
// WHEN
92-
var assertionError = expectAssertionError(() -> assertThat(future)
93-
.as("Custom description")
94-
.isCompletedWithValueMatchingWithin(s -> s.length() == 5,
95-
FIFTY_MS));
92+
AssertionError assertionError = expectAssertionError(() -> assertThat(future)
93+
.as("Custom description")
94+
.isCompletedWithValueMatchingWithin(s -> s.length() == 5,
95+
FIFTY_MS));
9696
// THEN
9797
then(assertionError)
9898
.hasMessageContaining("[Custom description]")
@@ -104,10 +104,10 @@ void should_fail_with_overridingErrorMessage() {
104104
// GIVEN
105105
CompletableFuture<String> future = completedFutureAfter("string", TEN_MS, executorService);
106106
// WHEN
107-
var assertionError = expectAssertionError(() -> assertThat(future)
108-
.overridingErrorMessage("Custom error message")
109-
.isCompletedWithValueMatchingWithin(s -> s.length() == 5,
110-
FIFTY_MS));
107+
AssertionError assertionError = expectAssertionError(() -> assertThat(future)
108+
.overridingErrorMessage("Custom error message")
109+
.isCompletedWithValueMatchingWithin(s -> s.length() == 5,
110+
FIFTY_MS));
111111
// THEN
112112
then(assertionError).hasMessage("Custom error message");
113113
}

assertj-core/src/test/java/org/assertj/core/api/future/CompletableFutureAssert_succeedsWithin_Test.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ void should_pass_custom_description() {
121121
String value = "done";
122122
CompletableFuture<String> future = completedFuture(value);
123123
// WHEN
124-
var assertionError = expectAssertionError(() -> assertThat(future).as("Custom description")
125-
.succeedsWithin(1, TimeUnit.MILLISECONDS, as(STRING))
126-
.startsWith("can"));
124+
AssertionError assertionError = expectAssertionError(() -> assertThat(future).as("Custom description")
125+
.succeedsWithin(1, TimeUnit.MILLISECONDS,
126+
as(STRING))
127+
.startsWith("can"));
127128
// THEN
128129
then(assertionError).hasMessageStartingWith("[Custom description]");
129130
}
@@ -134,9 +135,10 @@ void should_pass_overridingErrorMessage() {
134135
String value = "done";
135136
CompletableFuture<String> future = completedFuture(value);
136137
// WHEN
137-
var assertionError = expectAssertionError(() -> assertThat(future).overridingErrorMessage("Custom error")
138-
.succeedsWithin(1, TimeUnit.MILLISECONDS, as(STRING))
139-
.startsWith("can"));
138+
AssertionError assertionError = expectAssertionError(() -> assertThat(future).overridingErrorMessage("Custom error")
139+
.succeedsWithin(1, TimeUnit.MILLISECONDS,
140+
as(STRING))
141+
.startsWith("can"));
140142
// THEN
141143
then(assertionError).hasMessage("Custom error");
142144
}

assertj-core/src/test/java/org/assertj/core/api/future/CompletableFutureAssert_succeedsWithin_duration_Test.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ void should_pass_custom_description() {
121121
String value = "done";
122122
CompletableFuture<String> future = completedFuture(value);
123123
// WHEN
124-
var assertionError = expectAssertionError(() -> assertThat(future).as("Custom description")
125-
.succeedsWithin(Duration.ofMillis(1), as(STRING))
126-
.startsWith("can"));
124+
AssertionError assertionError = expectAssertionError(() -> assertThat(future).as("Custom description")
125+
.succeedsWithin(Duration.ofMillis(1), as(STRING))
126+
.startsWith("can"));
127127
// THEN
128128
then(assertionError).hasMessageStartingWith("[Custom description]");
129129
}
@@ -134,9 +134,9 @@ void should_pass_overridingErrorMessage() {
134134
String value = "done";
135135
CompletableFuture<String> future = completedFuture(value);
136136
// WHEN
137-
var assertionError = expectAssertionError(() -> assertThat(future).overridingErrorMessage("Custom error")
138-
.succeedsWithin(Duration.ofMillis(1), as(STRING))
139-
.startsWith("can"));
137+
AssertionError assertionError = expectAssertionError(() -> assertThat(future).overridingErrorMessage("Custom error")
138+
.succeedsWithin(Duration.ofMillis(1), as(STRING))
139+
.startsWith("can"));
140140
// THEN
141141
then(assertionError).hasMessage("Custom error");
142142
}

assertj-core/src/test/java/org/assertj/core/api/future/FutureAssert_succeedsWithin_Test.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ void should_pass_custom_description() {
109109
String value = "done";
110110
Future<String> future = completedFuture(value);
111111
// WHEN
112-
var assertionError = expectAssertionError(() -> assertThat(future).as("Custom description")
113-
.succeedsWithin(1, TimeUnit.MILLISECONDS, as(STRING))
114-
.startsWith("can"));
112+
AssertionError assertionError = expectAssertionError(() -> assertThat(future).as("Custom description")
113+
.succeedsWithin(1, TimeUnit.MILLISECONDS,
114+
as(STRING))
115+
.startsWith("can"));
115116
// THEN
116117
then(assertionError).hasMessageStartingWith("[Custom description]");
117118
}
@@ -122,9 +123,10 @@ void should_pass_overridingErrorMessage() {
122123
String value = "done";
123124
Future<String> future = completedFuture(value);
124125
// WHEN
125-
var assertionError = expectAssertionError(() -> assertThat(future).overridingErrorMessage("Custom error")
126-
.succeedsWithin(1, TimeUnit.MILLISECONDS, as(STRING))
127-
.startsWith("can"));
126+
AssertionError assertionError = expectAssertionError(() -> assertThat(future).overridingErrorMessage("Custom error")
127+
.succeedsWithin(1, TimeUnit.MILLISECONDS,
128+
as(STRING))
129+
.startsWith("can"));
128130
// THEN
129131
then(assertionError).hasMessage("Custom error");
130132
}

assertj-core/src/test/java/org/assertj/core/api/future/FutureAssert_succeedsWithin_duration_Test.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ void should_pass_custom_description() {
110110
String value = "done";
111111
Future<String> future = completedFuture(value);
112112
// WHEN
113-
var assertionError = expectAssertionError(() -> assertThat(future).as("Custom description")
114-
.succeedsWithin(Duration.ofMillis(1), as(STRING))
115-
.startsWith("can"));
113+
AssertionError assertionError = expectAssertionError(() -> assertThat(future).as("Custom description")
114+
.succeedsWithin(Duration.ofMillis(1), as(STRING))
115+
.startsWith("can"));
116116
// THEN
117117
then(assertionError).hasMessageStartingWith("[Custom description]");
118118
}
@@ -123,9 +123,9 @@ void should_pass_overridingErrorMessage() {
123123
String value = "done";
124124
Future<String> future = completedFuture(value);
125125
// WHEN
126-
var assertionError = expectAssertionError(() -> assertThat(future).overridingErrorMessage("Custom error")
127-
.succeedsWithin(Duration.ofMillis(1), as(STRING))
128-
.startsWith("can"));
126+
AssertionError assertionError = expectAssertionError(() -> assertThat(future).overridingErrorMessage("Custom error")
127+
.succeedsWithin(Duration.ofMillis(1), as(STRING))
128+
.startsWith("can"));
129129
// THEN
130130
then(assertionError).hasMessage("Custom error");
131131
}

0 commit comments

Comments
 (0)