|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2023 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -98,17 +98,6 @@ public static void state(boolean expression, Supplier<String> messageSupplier) {
|
98 | 98 | }
|
99 | 99 | }
|
100 | 100 |
|
101 |
| - /** |
102 |
| - * Assert a boolean expression, throwing an {@code IllegalStateException} |
103 |
| - * if the expression evaluates to {@code false}. |
104 |
| - * @deprecated as of 4.3.7, in favor of {@link #state(boolean, String)}; |
105 |
| - * to be removed in 6.1 |
106 |
| - */ |
107 |
| - @Deprecated(forRemoval = true) |
108 |
| - public static void state(boolean expression) { |
109 |
| - state(expression, "[Assertion failed] - this state invariant must be true"); |
110 |
| - } |
111 |
| - |
112 | 101 | /**
|
113 | 102 | * Assert a boolean expression, throwing an {@code IllegalArgumentException}
|
114 | 103 | * if the expression evaluates to {@code false}.
|
@@ -141,17 +130,6 @@ public static void isTrue(boolean expression, Supplier<String> messageSupplier)
|
141 | 130 | }
|
142 | 131 | }
|
143 | 132 |
|
144 |
| - /** |
145 |
| - * Assert a boolean expression, throwing an {@code IllegalArgumentException} |
146 |
| - * if the expression evaluates to {@code false}. |
147 |
| - * @deprecated as of 4.3.7, in favor of {@link #isTrue(boolean, String)}; |
148 |
| - * to be removed in 6.1 |
149 |
| - */ |
150 |
| - @Deprecated(forRemoval = true) |
151 |
| - public static void isTrue(boolean expression) { |
152 |
| - isTrue(expression, "[Assertion failed] - this expression must be true"); |
153 |
| - } |
154 |
| - |
155 | 133 | /**
|
156 | 134 | * Assert that an object is {@code null}.
|
157 | 135 | * <pre class="code">Assert.isNull(value, "The value must be null");</pre>
|
@@ -182,16 +160,6 @@ public static void isNull(@Nullable Object object, Supplier<String> messageSuppl
|
182 | 160 | }
|
183 | 161 | }
|
184 | 162 |
|
185 |
| - /** |
186 |
| - * Assert that an object is {@code null}. |
187 |
| - * @deprecated as of 4.3.7, in favor of {@link #isNull(Object, String)}; |
188 |
| - * to be removed in 6.1 |
189 |
| - */ |
190 |
| - @Deprecated(forRemoval = true) |
191 |
| - public static void isNull(@Nullable Object object) { |
192 |
| - isNull(object, "[Assertion failed] - the object argument must be null"); |
193 |
| - } |
194 |
| - |
195 | 163 | /**
|
196 | 164 | * Assert that an object is not {@code null}.
|
197 | 165 | * <pre class="code">Assert.notNull(clazz, "The class must not be null");</pre>
|
@@ -223,16 +191,6 @@ public static void notNull(@Nullable Object object, Supplier<String> messageSupp
|
223 | 191 | }
|
224 | 192 | }
|
225 | 193 |
|
226 |
| - /** |
227 |
| - * Assert that an object is not {@code null}. |
228 |
| - * @deprecated as of 4.3.7, in favor of {@link #notNull(Object, String)}; |
229 |
| - * to be removed in 6.1 |
230 |
| - */ |
231 |
| - @Deprecated(forRemoval = true) |
232 |
| - public static void notNull(@Nullable Object object) { |
233 |
| - notNull(object, "[Assertion failed] - this argument is required; it must not be null"); |
234 |
| - } |
235 |
| - |
236 | 194 | /**
|
237 | 195 | * Assert that the given String is not empty; that is,
|
238 | 196 | * it must not be {@code null} and not the empty String.
|
@@ -268,18 +226,6 @@ public static void hasLength(@Nullable String text, Supplier<String> messageSupp
|
268 | 226 | }
|
269 | 227 | }
|
270 | 228 |
|
271 |
| - /** |
272 |
| - * Assert that the given String is not empty; that is, |
273 |
| - * it must not be {@code null} and not the empty String. |
274 |
| - * @deprecated as of 4.3.7, in favor of {@link #hasLength(String, String)}; |
275 |
| - * to be removed in 6.1 |
276 |
| - */ |
277 |
| - @Deprecated(forRemoval = true) |
278 |
| - public static void hasLength(@Nullable String text) { |
279 |
| - hasLength(text, |
280 |
| - "[Assertion failed] - this String argument must have length; it must not be null or empty"); |
281 |
| - } |
282 |
| - |
283 | 229 | /**
|
284 | 230 | * Assert that the given String contains valid text content; that is, it must not
|
285 | 231 | * be {@code null} and must contain at least one non-whitespace character.
|
@@ -315,18 +261,6 @@ public static void hasText(@Nullable String text, Supplier<String> messageSuppli
|
315 | 261 | }
|
316 | 262 | }
|
317 | 263 |
|
318 |
| - /** |
319 |
| - * Assert that the given String contains valid text content; that is, it must not |
320 |
| - * be {@code null} and must contain at least one non-whitespace character. |
321 |
| - * @deprecated as of 4.3.7, in favor of {@link #hasText(String, String)}; |
322 |
| - * to be removed in 6.1 |
323 |
| - */ |
324 |
| - @Deprecated(forRemoval = true) |
325 |
| - public static void hasText(@Nullable String text) { |
326 |
| - hasText(text, |
327 |
| - "[Assertion failed] - this String argument must have text; it must not be null, empty, or blank"); |
328 |
| - } |
329 |
| - |
330 | 264 | /**
|
331 | 265 | * Assert that the given text does not contain the given substring.
|
332 | 266 | * <pre class="code">Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");</pre>
|
@@ -361,17 +295,6 @@ public static void doesNotContain(@Nullable String textToSearch, String substrin
|
361 | 295 | }
|
362 | 296 | }
|
363 | 297 |
|
364 |
| - /** |
365 |
| - * Assert that the given text does not contain the given substring. |
366 |
| - * @deprecated as of 4.3.7, in favor of {@link #doesNotContain(String, String, String)}; |
367 |
| - * to be removed in 6.1 |
368 |
| - */ |
369 |
| - @Deprecated(forRemoval = true) |
370 |
| - public static void doesNotContain(@Nullable String textToSearch, String substring) { |
371 |
| - doesNotContain(textToSearch, substring, |
372 |
| - () -> "[Assertion failed] - this String argument must not contain the substring [" + substring + "]"); |
373 |
| - } |
374 |
| - |
375 | 298 | /**
|
376 | 299 | * Assert that an array contains elements; that is, it must not be
|
377 | 300 | * {@code null} and must contain at least one element.
|
@@ -404,17 +327,6 @@ public static void notEmpty(@Nullable Object[] array, Supplier<String> messageSu
|
404 | 327 | }
|
405 | 328 | }
|
406 | 329 |
|
407 |
| - /** |
408 |
| - * Assert that an array contains elements; that is, it must not be |
409 |
| - * {@code null} and must contain at least one element. |
410 |
| - * @deprecated as of 4.3.7, in favor of {@link #notEmpty(Object[], String)}; |
411 |
| - * to be removed in 6.1 |
412 |
| - */ |
413 |
| - @Deprecated(forRemoval = true) |
414 |
| - public static void notEmpty(@Nullable Object[] array) { |
415 |
| - notEmpty(array, "[Assertion failed] - this array must not be empty: it must contain at least 1 element"); |
416 |
| - } |
417 |
| - |
418 | 330 | /**
|
419 | 331 | * Assert that an array contains no {@code null} elements.
|
420 | 332 | * <p>Note: Does not complain if the array is empty!
|
@@ -455,16 +367,6 @@ public static void noNullElements(@Nullable Object[] array, Supplier<String> mes
|
455 | 367 | }
|
456 | 368 | }
|
457 | 369 |
|
458 |
| - /** |
459 |
| - * Assert that an array contains no {@code null} elements. |
460 |
| - * @deprecated as of 4.3.7, in favor of {@link #noNullElements(Object[], String)}; |
461 |
| - * to be removed in 6.1 |
462 |
| - */ |
463 |
| - @Deprecated(forRemoval = true) |
464 |
| - public static void noNullElements(@Nullable Object[] array) { |
465 |
| - noNullElements(array, "[Assertion failed] - this array must not contain any null elements"); |
466 |
| - } |
467 |
| - |
468 | 370 | /**
|
469 | 371 | * Assert that a collection contains elements; that is, it must not be
|
470 | 372 | * {@code null} and must contain at least one element.
|
@@ -499,18 +401,6 @@ public static void notEmpty(@Nullable Collection<?> collection, Supplier<String>
|
499 | 401 | }
|
500 | 402 | }
|
501 | 403 |
|
502 |
| - /** |
503 |
| - * Assert that a collection contains elements; that is, it must not be |
504 |
| - * {@code null} and must contain at least one element. |
505 |
| - * @deprecated as of 4.3.7, in favor of {@link #notEmpty(Collection, String)}; |
506 |
| - * to be removed in 6.1 |
507 |
| - */ |
508 |
| - @Deprecated(forRemoval = true) |
509 |
| - public static void notEmpty(@Nullable Collection<?> collection) { |
510 |
| - notEmpty(collection, |
511 |
| - "[Assertion failed] - this collection must not be empty: it must contain at least 1 element"); |
512 |
| - } |
513 |
| - |
514 | 404 | /**
|
515 | 405 | * Assert that a collection contains no {@code null} elements.
|
516 | 406 | * <p>Note: Does not complain if the collection is empty!
|
@@ -584,17 +474,6 @@ public static void notEmpty(@Nullable Map<?, ?> map, Supplier<String> messageSup
|
584 | 474 | }
|
585 | 475 | }
|
586 | 476 |
|
587 |
| - /** |
588 |
| - * Assert that a Map contains entries; that is, it must not be {@code null} |
589 |
| - * and must contain at least one entry. |
590 |
| - * @deprecated as of 4.3.7, in favor of {@link #notEmpty(Map, String)}; |
591 |
| - * to be removed in 6.1 |
592 |
| - */ |
593 |
| - @Deprecated(forRemoval = true) |
594 |
| - public static void notEmpty(@Nullable Map<?, ?> map) { |
595 |
| - notEmpty(map, "[Assertion failed] - this map must not be empty; it must contain at least one entry"); |
596 |
| - } |
597 |
| - |
598 | 477 | /**
|
599 | 478 | * Assert that the provided object is an instance of the provided class.
|
600 | 479 | * <pre class="code">Assert.instanceOf(Foo.class, foo, "Foo expected");</pre>
|
|
0 commit comments