summaryrefslogtreecommitdiff
path: root/dev-java/assertj-core/files/assertj-core-3.10.0-java11-compatibility.patch
blob: 3f5210ae8458775e67cd126e739513ade91f6250 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
From 2e107db2a40c5ef60d4f5370e1e71fa780b67599 Mon Sep 17 00:00:00 2001
From: Erhard Pointl <epeee@users.noreply.github.com>
Date: Wed, 23 May 2018 11:45:35 +0200
Subject: [PATCH] java11 compatibility (#1243)

Fix java11 ea compile errors by adding assertThat method for StringBuilder and StringBuffer to disambiguate method resolution as StringBuilder and StringBuffer implements Comparable in java 11
---
 .../java/org/assertj/core/api/Assertions.java | 23 ++++++++++++
 .../core/api/AssertionsForClassTypes.java     | 24 +++++++++++++
 .../org/assertj/core/api/Assumptions.java     | 25 +++++++++++++
 .../org/assertj/core/api/BDDAssertions.java   | 24 +++++++++++++
 .../api/Java6AbstractBDDSoftAssertions.java   | 24 +++++++++++++
 .../Java6AbstractStandardSoftAssertions.java  | 24 +++++++++++++
 .../org/assertj/core/api/Java6Assertions.java | 24 +++++++++++++
 .../assertj/core/api/Java6BDDAssertions.java  | 24 +++++++++++++
 .../org/assertj/core/api/WithAssertions.java  | 24 +++++++++++++
 .../org/assertj/core/api/WithAssumptions.java | 23 ++++++++++++
 ...ons_assertThat_with_StringBuffer_Test.java | 36 +++++++++++++++++++
 ...ns_assertThat_with_StringBuilder_Test.java | 36 +++++++++++++++++++
 12 files changed, 311 insertions(+)
 create mode 100644 src/test/java/org/assertj/core/api/Assertions_assertThat_with_StringBuffer_Test.java
 create mode 100644 src/test/java/org/assertj/core/api/Assertions_assertThat_with_StringBuilder_Test.java

diff --git a/src/main/java/org/assertj/core/api/Assertions.java b/src/main/java/org/assertj/core/api/Assertions.java
index 28c457f4c7..664748dad3 100644
--- a/src/main/java/org/assertj/core/api/Assertions.java
+++ b/src/main/java/org/assertj/core/api/Assertions.java
@@ -2565,6 +2565,29 @@ public static <T> T assertThat(final AssertProvider<T> component) {
     return AssertionsForInterfaceTypes.assertThat(actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(StringBuilder actual) {
+    return AssertionsForClassTypes.assertThat(actual);
+  }
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(StringBuffer actual) {
+    return AssertionsForClassTypes.assertThat(actual);
+  }
+
   /**
    * Creates a new instance of <code>{@link CharSequenceAssert}from a {@link String}</code>.
    *
diff --git a/src/main/java/org/assertj/core/api/AssertionsForClassTypes.java b/src/main/java/org/assertj/core/api/AssertionsForClassTypes.java
index fd05593159..fb2e2acfbd 100644
--- a/src/main/java/org/assertj/core/api/AssertionsForClassTypes.java
+++ b/src/main/java/org/assertj/core/api/AssertionsForClassTypes.java
@@ -487,6 +487,30 @@ public static AbstractShortArrayAssert<?> assertThat(short[] actual) {
     return new ShortArrayAssert(actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(StringBuilder actual) {
+    return new CharSequenceAssert(actual);
+  }
+
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(StringBuffer actual) {
+    return new CharSequenceAssert(actual);
+  }
+
   /**
    * Creates a new instance of <code>{@link StringAssert}</code>.
    *
diff --git a/src/main/java/org/assertj/core/api/Assumptions.java b/src/main/java/org/assertj/core/api/Assumptions.java
index 9ce773bd44..d26b2453ce 100644
--- a/src/main/java/org/assertj/core/api/Assumptions.java
+++ b/src/main/java/org/assertj/core/api/Assumptions.java
@@ -308,6 +308,31 @@ public static AbstractCharArrayAssert<?> assumeThat(char[] actual) {
     return asAssumption(CharSequenceAssert.class, CharSequence.class, actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> assumption from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assumption for assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(StringBuilder actual) {
+    return asAssumption(CharSequenceAssert.class, CharSequence.class, actual);
+  }
+
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> assumption from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assumption for assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(StringBuffer actual) {
+    return asAssumption(CharSequenceAssert.class, CharSequence.class, actual);
+  }
+
+
   /**
    * Creates a new instance of <code>{@link ShortAssert}</code> assumption.
    *
diff --git a/src/main/java/org/assertj/core/api/BDDAssertions.java b/src/main/java/org/assertj/core/api/BDDAssertions.java
index c558153faf..03e574a8d2 100644
--- a/src/main/java/org/assertj/core/api/BDDAssertions.java
+++ b/src/main/java/org/assertj/core/api/BDDAssertions.java
@@ -800,6 +800,30 @@ public static AbstractShortArrayAssert<?> then(short[] actual) {
     return assertThat(actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link org.assertj.core.api.CharSequenceAssert}</code> from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> then(StringBuilder actual) {
+    return assertThat(actual);
+  }
+
+  /**
+   * Creates a new instance of <code>{@link org.assertj.core.api.CharSequenceAssert}</code> from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> then(StringBuffer actual) {
+    return assertThat(actual);
+  }
+
   /**
    * Creates a new instance of <code>{@link org.assertj.core.api.StringAssert}</code>.
    *
diff --git a/src/main/java/org/assertj/core/api/Java6AbstractBDDSoftAssertions.java b/src/main/java/org/assertj/core/api/Java6AbstractBDDSoftAssertions.java
index bd54285ae1..edb0451067 100644
--- a/src/main/java/org/assertj/core/api/Java6AbstractBDDSoftAssertions.java
+++ b/src/main/java/org/assertj/core/api/Java6AbstractBDDSoftAssertions.java
@@ -487,6 +487,30 @@ public CharSequenceAssert then(CharSequence actual) {
     return proxy(CharSequenceAssert.class, CharSequence.class, actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public CharSequenceAssert then(StringBuilder actual) {
+    return proxy(CharSequenceAssert.class, CharSequence.class, actual);
+  }
+
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public CharSequenceAssert then(StringBuffer actual) {
+    return proxy(CharSequenceAssert.class, CharSequence.class, actual);
+  }
+
   /**
    * Creates a new instance of <code>{@link StringAssert}</code>.
    *
diff --git a/src/main/java/org/assertj/core/api/Java6AbstractStandardSoftAssertions.java b/src/main/java/org/assertj/core/api/Java6AbstractStandardSoftAssertions.java
index ee9d3fb72d..4ff4315635 100644
--- a/src/main/java/org/assertj/core/api/Java6AbstractStandardSoftAssertions.java
+++ b/src/main/java/org/assertj/core/api/Java6AbstractStandardSoftAssertions.java
@@ -489,6 +489,30 @@ public CharSequenceAssert assertThat(CharSequence actual) {
     return proxy(CharSequenceAssert.class, CharSequence.class, actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public CharSequenceAssert assertThat(StringBuilder actual) {
+    return proxy(CharSequenceAssert.class, CharSequence.class, actual);
+  }
+
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public CharSequenceAssert assertThat(StringBuffer actual) {
+    return proxy(CharSequenceAssert.class, CharSequence.class, actual);
+  }
+
   /**
    * Creates a new instance of <code>{@link StringAssert}</code>.
    *
diff --git a/src/main/java/org/assertj/core/api/Java6Assertions.java b/src/main/java/org/assertj/core/api/Java6Assertions.java
index e88ccde3c8..10912f41bc 100644
--- a/src/main/java/org/assertj/core/api/Java6Assertions.java
+++ b/src/main/java/org/assertj/core/api/Java6Assertions.java
@@ -924,6 +924,30 @@ public static AbstractShortArrayAssert<?> assertThat(short[] actual) {
     return new CharSequenceAssert(actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(StringBuilder actual) {
+    return new CharSequenceAssert(actual);
+  }
+
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(StringBuffer actual) {
+    return new CharSequenceAssert(actual);
+  }
+
   /**
    * Creates a new instance of <code>{@link StringAssert}</code>.
    *
diff --git a/src/main/java/org/assertj/core/api/Java6BDDAssertions.java b/src/main/java/org/assertj/core/api/Java6BDDAssertions.java
index 4ffc23475b..009929ebc9 100644
--- a/src/main/java/org/assertj/core/api/Java6BDDAssertions.java
+++ b/src/main/java/org/assertj/core/api/Java6BDDAssertions.java
@@ -795,6 +795,30 @@ public static AbstractShortArrayAssert<?> then(short[] actual) {
     return assertThat(actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link org.assertj.core.api.CharSequenceAssert}</code> from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> then(StringBuilder actual) {
+    return assertThat(actual);
+  }
+
+  /**
+   * Creates a new instance of <code>{@link org.assertj.core.api.CharSequenceAssert}</code> from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  public static AbstractCharSequenceAssert<?, ? extends CharSequence> then(StringBuffer actual) {
+    return assertThat(actual);
+  }
+
   /**
    * Creates a new instance of <code>{@link org.assertj.core.api.StringAssert}</code>.
    *
diff --git a/src/main/java/org/assertj/core/api/WithAssertions.java b/src/main/java/org/assertj/core/api/WithAssertions.java
index c87854dd89..b71250c1bd 100644
--- a/src/main/java/org/assertj/core/api/WithAssertions.java
+++ b/src/main/java/org/assertj/core/api/WithAssertions.java
@@ -564,6 +564,30 @@ default <VALUE> AtomicStampedReferenceAssert<VALUE> assertThat(AtomicStampedRefe
     return Assertions.assertThat(actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  default AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(final StringBuilder actual) {
+    return Assertions.assertThat(actual);
+  }
+
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  default AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(final StringBuffer actual) {
+    return Assertions.assertThat(actual);
+  }
+
   /**
    * Creates a new instance of <code>{@link ShortArrayAssert}</code>.
    *
diff --git a/src/main/java/org/assertj/core/api/WithAssumptions.java b/src/main/java/org/assertj/core/api/WithAssumptions.java
index 0703fa33dd..56539e36dd 100644
--- a/src/main/java/org/assertj/core/api/WithAssumptions.java
+++ b/src/main/java/org/assertj/core/api/WithAssumptions.java
@@ -371,6 +371,29 @@ default <VALUE> AtomicStampedReferenceAssert<VALUE> assumeThat(AtomicStampedRefe
     return Assumptions.assumeThat(actual);
   }
 
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> assumption from a {@link StringBuilder}.
+   *
+   * @param actual the actual value.
+   * @return the created assumption for assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  default AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(final StringBuilder actual) {
+    return Assumptions.assumeThat(actual);
+  }
+
+  /**
+   * Creates a new instance of <code>{@link CharSequenceAssert}</code> assumption from a {@link StringBuffer}.
+   *
+   * @param actual the actual value.
+   * @return the created assumption for assertion object.
+   * @since 3.11.0
+   */
+  @CheckReturnValue
+  default AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(final StringBuffer actual) {
+    return Assumptions.assumeThat(actual);
+  }
   /**
    * Creates a new instance of <code>{@link ShortArrayAssert}</code> assumption.
    *
diff --git a/src/test/java/org/assertj/core/api/Assertions_assertThat_with_StringBuffer_Test.java b/src/test/java/org/assertj/core/api/Assertions_assertThat_with_StringBuffer_Test.java
new file mode 100644
index 0000000000..b3f020f101
--- /dev/null
+++ b/src/test/java/org/assertj/core/api/Assertions_assertThat_with_StringBuffer_Test.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ *
+ * Copyright 2012-2018 the original author or authors.
+ */
+package org.assertj.core.api;
+
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for <code>{@link Assertions#assertThat(StringBuffer)}</code>.
+ */
+public class Assertions_assertThat_with_StringBuffer_Test {
+
+  @Test
+  public void should_create_Assert() {
+    AbstractCharSequenceAssert<?, ?> assertions = Assertions.assertThat(new StringBuffer("Yoda"));
+    assertThat(assertions).isNotNull();
+  }
+
+  @Test
+  public void should_pass_actual() {
+    StringBuffer actual = new StringBuffer("Yoda");
+    AbstractCharSequenceAssert<?, ?> assertions = Assertions.assertThat(actual);
+    assertThat(assertions.actual).isSameAs(actual);
+  }
+}
diff --git a/src/test/java/org/assertj/core/api/Assertions_assertThat_with_StringBuilder_Test.java b/src/test/java/org/assertj/core/api/Assertions_assertThat_with_StringBuilder_Test.java
new file mode 100644
index 0000000000..315d6d4b9f
--- /dev/null
+++ b/src/test/java/org/assertj/core/api/Assertions_assertThat_with_StringBuilder_Test.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ *
+ * Copyright 2012-2018 the original author or authors.
+ */
+package org.assertj.core.api;
+
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for <code>{@link Assertions#assertThat(StringBuilder)}</code>.
+ */
+public class Assertions_assertThat_with_StringBuilder_Test {
+
+  @Test
+  public void should_create_Assert() {
+    AbstractCharSequenceAssert<?, ?> assertions = Assertions.assertThat(new StringBuilder("Yoda"));
+    assertThat(assertions).isNotNull();
+  }
+
+  @Test
+  public void should_pass_actual() {
+    StringBuilder actual = new StringBuilder("Yoda");
+    AbstractCharSequenceAssert<?, ?> assertions = Assertions.assertThat(actual);
+    assertThat(assertions.actual).isSameAs(actual);
+  }
+}