| 1 | /* |
| 2 | * Copyright 2015-2024 the original author or authors. |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v2.0 which |
| 6 | * accompanies this distribution and is available at |
| 7 | * |
| 8 | * https://www.eclipse.org/legal/epl-v20.html |
| 9 | */ |
| 10 | |
| 11 | package org.junit.jupiter.api; |
| 12 | |
| 13 | import static org.apiguardian.api.API.Status.INTERNAL; |
| 14 | import static org.apiguardian.api.API.Status.STABLE; |
| 15 | |
| 16 | import java.time.Duration; |
| 17 | import java.util.Arrays; |
| 18 | import java.util.Collection; |
| 19 | import java.util.List; |
| 20 | import java.util.Objects; |
| 21 | import java.util.function.BooleanSupplier; |
| 22 | import java.util.function.Supplier; |
| 23 | import java.util.stream.Stream; |
| 24 | |
| 25 | import org.apiguardian.api.API; |
| 26 | import org.junit.jupiter.api.function.Executable; |
| 27 | import org.junit.jupiter.api.function.ThrowingSupplier; |
| 28 | import org.opentest4j.MultipleFailuresError; |
| 29 | |
| 30 | /** |
| 31 | * {@code Assertions} is a collection of utility methods that support asserting |
| 32 | * conditions in tests. |
| 33 | * |
| 34 | * <p>Unless otherwise noted, a <em>failed</em> assertion will throw an |
| 35 | * {@link org.opentest4j.AssertionFailedError} or a subclass thereof. |
| 36 | * |
| 37 | * <h2>Object Equality</h2> |
| 38 | * |
| 39 | * <p>Assertion methods comparing two objects for <em>equality</em>, such as the |
| 40 | * {@code assertEquals(expected, actual)} and {@code assertNotEquals(unexpected, actual)} |
| 41 | * variants, are <em>only</em> intended to test equality for an (un-)expected value |
| 42 | * and an actual value. They are not designed for testing whether a class correctly |
| 43 | * implements {@link Object#equals(Object)}. For example, {@code assertEquals()} |
| 44 | * might immediately return {@code true} when provided the same object for the |
| 45 | * expected and actual values, without calling {@code equals(Object)} at all. |
| 46 | * Tests that aim to verify the {@code equals(Object)} implementation should instead |
| 47 | * be written to explicitly verify the {@link Object#equals(Object)} contract by |
| 48 | * using {@link #assertTrue(boolean) assertTrue()} or {@link #assertFalse(boolean) |
| 49 | * assertFalse()} — for example, {@code assertTrue(expected.equals(actual))}, |
| 50 | * {@code assertTrue(actual.equals(expected))}, {@code assertFalse(expected.equals(null))}, |
| 51 | * etc. |
| 52 | * |
| 53 | * <h2>Kotlin Support</h2> |
| 54 | * |
| 55 | * <p>Additional <a href="https://kotlinlang.org/">Kotlin</a> assertions can be |
| 56 | * found as <em>top-level functions</em> in the {@link org.junit.jupiter.api} |
| 57 | * package. |
| 58 | * |
| 59 | * <h2>Preemptive Timeouts</h2> |
| 60 | * |
| 61 | * <p>The various {@code assertTimeoutPreemptively()} methods in this class |
| 62 | * execute the provided callback ({@code executable} or {@code supplier}) in a |
| 63 | * different thread than that of the calling code. If the timeout is exceeded, |
| 64 | * an attempt will be made to preemptively abort execution of the callback by |
| 65 | * {@linkplain Thread#interrupt() interrupting} the callback's thread. If the |
| 66 | * callback's thread does not return when interrupted, the thread will continue |
| 67 | * to run in the background after the {@code assertTimeoutPreemptively()} method |
| 68 | * has returned. |
| 69 | * |
| 70 | * <p>Furthermore, the behavior of {@code assertTimeoutPreemptively()} methods |
| 71 | * can lead to undesirable side effects if the code that is executed within the |
| 72 | * callback relies on {@link ThreadLocal} storage. One common example of this is |
| 73 | * the transactional testing support in the Spring Framework. Specifically, Spring's |
| 74 | * testing support binds transaction state to the current thread (via a |
| 75 | * {@code ThreadLocal}) before a test method is invoked. Consequently, if a |
| 76 | * callback provided to {@code assertTimeoutPreemptively()} invokes Spring-managed |
| 77 | * components that participate in transactions, any actions taken by those |
| 78 | * components will not be rolled back with the test-managed transaction. On the |
| 79 | * contrary, such actions will be committed to the persistent store (e.g., |
| 80 | * relational database) even though the test-managed transaction is rolled back. |
| 81 | * Similar side effects may be encountered with other frameworks that rely on |
| 82 | * {@code ThreadLocal} storage. |
| 83 | * |
| 84 | * <h2>Extensibility</h2> |
| 85 | * |
| 86 | * <p>Although it is technically possible to extend this class, extension is |
| 87 | * strongly discouraged. The JUnit Team highly recommends that the methods |
| 88 | * defined in this class be used via <em>static imports</em>. |
| 89 | * |
| 90 | * @since 5.0 |
| 91 | * @see org.opentest4j.AssertionFailedError |
| 92 | * @see Assumptions |
| 93 | */ |
| 94 | @API(status = STABLE, since = "5.0") |
| 95 | public class Assertions { |
| 96 | |
| 97 | /** |
| 98 | * Protected constructor allowing subclassing but not direct instantiation. |
| 99 | * |
| 100 | * @since 5.3 |
| 101 | */ |
| 102 | @API(status = STABLE, since = "5.3") |
| 103 | protected Assertions() { |
| 104 | /* no-op */ |
| 105 | } |
| 106 | |
| 107 | // --- fail ---------------------------------------------------------------- |
| 108 | |
| 109 | /** |
| 110 | * <em>Fail</em> the test <em>without</em> a failure message. |
| 111 | * |
| 112 | * <p>Although failing <em>with</em> an explicit failure message is recommended, |
| 113 | * this method may be useful when maintaining legacy code. |
| 114 | * |
| 115 | * <p>See Javadoc for {@link #fail(String)} for an explanation of this method's |
| 116 | * generic return type {@code V}. |
| 117 | */ |
| 118 | public static <V> V fail() { |
| 119 | AssertionUtils.fail(); |
| 120 | return null; // appeasing the compiler: this line will never be executed. |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * <em>Fail</em> the test with the given failure {@code message}. |
| 125 | * |
| 126 | * <p>The generic return type {@code V} allows this method to be used |
| 127 | * directly as a single-statement lambda expression, thereby avoiding the |
| 128 | * need to implement a code block with an explicit return value. Since this |
| 129 | * method throws an {@link org.opentest4j.AssertionFailedError} before its |
| 130 | * return statement, this method never actually returns a value to its caller. |
| 131 | * The following example demonstrates how this may be used in practice. |
| 132 | * |
| 133 | * <pre>{@code |
| 134 | * Stream.of().map(entry -> fail("should not be called")); |
| 135 | * }</pre> |
| 136 | */ |
| 137 | public static <V> V fail(String message) { |
| 138 | AssertionUtils.fail(message); |
| 139 | return null; // appeasing the compiler: this line will never be executed. |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * <em>Fail</em> the test with the given failure {@code message} as well |
| 144 | * as the underlying {@code cause}. |
| 145 | * |
| 146 | * <p>See Javadoc for {@link #fail(String)} for an explanation of this method's |
| 147 | * generic return type {@code V}. |
| 148 | */ |
| 149 | public static <V> V fail(String message, Throwable cause) { |
| 150 | AssertionUtils.fail(message, cause); |
| 151 | return null; // appeasing the compiler: this line will never be executed. |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * <em>Fail</em> the test with the given underlying {@code cause}. |
| 156 | * |
| 157 | * <p>See Javadoc for {@link #fail(String)} for an explanation of this method's |
| 158 | * generic return type {@code V}. |
| 159 | */ |
| 160 | public static <V> V fail(Throwable cause) { |
| 161 | AssertionUtils.fail(cause); |
| 162 | return null; // appeasing the compiler: this line will never be executed. |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * <em>Fail</em> the test with the failure message retrieved from the |
| 167 | * given {@code messageSupplier}. |
| 168 | * |
| 169 | * <p>See Javadoc for {@link #fail(String)} for an explanation of this method's |
| 170 | * generic return type {@code V}. |
| 171 | */ |
| 172 | public static <V> V fail(Supplier<String> messageSupplier) { |
| 173 | AssertionUtils.fail(messageSupplier); |
| 174 | return null; // appeasing the compiler: this line will never be executed. |
| 175 | } |
| 176 | |
| 177 | // --- assertTrue ---------------------------------------------------------- |
| 178 | |
| 179 | /** |
| 180 | * <em>Assert</em> that the supplied {@code condition} is {@code true}. |
| 181 | */ |
| 182 | public static void assertTrue(boolean condition) { |
| 183 | AssertTrue.assertTrue(condition); |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * <em>Assert</em> that the supplied {@code condition} is {@code true}. |
| 188 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 189 | */ |
| 190 | public static void assertTrue(boolean condition, Supplier<String> messageSupplier) { |
| 191 | AssertTrue.assertTrue(condition, messageSupplier); |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * <em>Assert</em> that the boolean condition supplied by {@code booleanSupplier} is {@code true}. |
| 196 | */ |
| 197 | public static void assertTrue(BooleanSupplier booleanSupplier) { |
| 198 | AssertTrue.assertTrue(booleanSupplier); |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * <em>Assert</em> that the boolean condition supplied by {@code booleanSupplier} is {@code true}. |
| 203 | * <p>Fails with the supplied failure {@code message}. |
| 204 | */ |
| 205 | public static void assertTrue(BooleanSupplier booleanSupplier, String message) { |
| 206 | AssertTrue.assertTrue(booleanSupplier, message); |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * <em>Assert</em> that the supplied {@code condition} is {@code true}. |
| 211 | * <p>Fails with the supplied failure {@code message}. |
| 212 | */ |
| 213 | public static void assertTrue(boolean condition, String message) { |
| 214 | AssertTrue.assertTrue(condition, message); |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * <em>Assert</em> that the boolean condition supplied by {@code booleanSupplier} is {@code true}. |
| 219 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 220 | */ |
| 221 | public static void assertTrue(BooleanSupplier booleanSupplier, Supplier<String> messageSupplier) { |
| 222 | AssertTrue.assertTrue(booleanSupplier, messageSupplier); |
| 223 | } |
| 224 | |
| 225 | // --- assertFalse --------------------------------------------------------- |
| 226 | |
| 227 | /** |
| 228 | * <em>Assert</em> that the supplied {@code condition} is {@code false}. |
| 229 | */ |
| 230 | public static void assertFalse(boolean condition) { |
| 231 | AssertFalse.assertFalse(condition); |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * <em>Assert</em> that the supplied {@code condition} is {@code false}. |
| 236 | * <p>Fails with the supplied failure {@code message}. |
| 237 | */ |
| 238 | public static void assertFalse(boolean condition, String message) { |
| 239 | AssertFalse.assertFalse(condition, message); |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * <em>Assert</em> that the supplied {@code condition} is {@code false}. |
| 244 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 245 | */ |
| 246 | public static void assertFalse(boolean condition, Supplier<String> messageSupplier) { |
| 247 | AssertFalse.assertFalse(condition, messageSupplier); |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * <em>Assert</em> that the boolean condition supplied by {@code booleanSupplier} is {@code false}. |
| 252 | */ |
| 253 | public static void assertFalse(BooleanSupplier booleanSupplier) { |
| 254 | AssertFalse.assertFalse(booleanSupplier); |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * <em>Assert</em> that the boolean condition supplied by {@code booleanSupplier} is {@code false}. |
| 259 | * <p>Fails with the supplied failure {@code message}. |
| 260 | */ |
| 261 | public static void assertFalse(BooleanSupplier booleanSupplier, String message) { |
| 262 | AssertFalse.assertFalse(booleanSupplier, message); |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * <em>Assert</em> that the boolean condition supplied by {@code booleanSupplier} is {@code false}. |
| 267 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 268 | */ |
| 269 | public static void assertFalse(BooleanSupplier booleanSupplier, Supplier<String> messageSupplier) { |
| 270 | AssertFalse.assertFalse(booleanSupplier, messageSupplier); |
| 271 | } |
| 272 | |
| 273 | // --- assertNull ---------------------------------------------------------- |
| 274 | |
| 275 | /** |
| 276 | * <em>Assert</em> that {@code actual} is {@code null}. |
| 277 | */ |
| 278 | public static void assertNull(Object actual) { |
| 279 | AssertNull.assertNull(actual); |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * <em>Assert</em> that {@code actual} is {@code null}. |
| 284 | * <p>Fails with the supplied failure {@code message}. |
| 285 | */ |
| 286 | public static void assertNull(Object actual, String message) { |
| 287 | AssertNull.assertNull(actual, message); |
| 288 | } |
| 289 | |
| 290 | /** |
| 291 | * <em>Assert</em> that {@code actual} is {@code null}. |
| 292 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 293 | */ |
| 294 | public static void assertNull(Object actual, Supplier<String> messageSupplier) { |
| 295 | AssertNull.assertNull(actual, messageSupplier); |
| 296 | } |
| 297 | |
| 298 | // --- assertNotNull ------------------------------------------------------- |
| 299 | |
| 300 | /** |
| 301 | * <em>Assert</em> that {@code actual} is not {@code null}. |
| 302 | */ |
| 303 | public static void assertNotNull(Object actual) { |
| 304 | AssertNotNull.assertNotNull(actual); |
| 305 | } |
| 306 | |
| 307 | /** |
| 308 | * <em>Assert</em> that {@code actual} is not {@code null}. |
| 309 | * <p>Fails with the supplied failure {@code message}. |
| 310 | */ |
| 311 | public static void assertNotNull(Object actual, String message) { |
| 312 | AssertNotNull.assertNotNull(actual, message); |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * <em>Assert</em> that {@code actual} is not {@code null}. |
| 317 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 318 | */ |
| 319 | public static void assertNotNull(Object actual, Supplier<String> messageSupplier) { |
| 320 | AssertNotNull.assertNotNull(actual, messageSupplier); |
| 321 | } |
| 322 | |
| 323 | // --- assertEquals -------------------------------------------------------- |
| 324 | |
| 325 | /** |
| 326 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 327 | */ |
| 328 | public static void assertEquals(short expected, short actual) { |
| 329 | AssertEquals.assertEquals(expected, actual); |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 334 | */ |
| 335 | public static void assertEquals(short expected, Short actual) { |
| 336 | AssertEquals.assertEquals((Short) expected, actual); |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 341 | */ |
| 342 | public static void assertEquals(Short expected, short actual) { |
| 343 | AssertEquals.assertEquals(expected, (Short) actual); |
| 344 | } |
| 345 | |
| 346 | /** |
| 347 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 348 | * |
| 349 | * @since 5.4 |
| 350 | */ |
| 351 | @API(status = STABLE, since = "5.4") |
| 352 | public static void assertEquals(Short expected, Short actual) { |
| 353 | AssertEquals.assertEquals(expected, actual); |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 358 | * <p>Fails with the supplied failure {@code message}. |
| 359 | */ |
| 360 | public static void assertEquals(short expected, short actual, String message) { |
| 361 | AssertEquals.assertEquals(expected, actual, message); |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 366 | * <p>Fails with the supplied failure {@code message}. |
| 367 | */ |
| 368 | public static void assertEquals(short expected, Short actual, String message) { |
| 369 | AssertEquals.assertEquals((Short) expected, actual, message); |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 374 | * <p>Fails with the supplied failure {@code message}. |
| 375 | */ |
| 376 | public static void assertEquals(Short expected, short actual, String message) { |
| 377 | AssertEquals.assertEquals(expected, (Short) actual, message); |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 382 | * <p>Fails with the supplied failure {@code message}. |
| 383 | * |
| 384 | * @since 5.4 |
| 385 | */ |
| 386 | @API(status = STABLE, since = "5.4") |
| 387 | public static void assertEquals(Short expected, Short actual, String message) { |
| 388 | AssertEquals.assertEquals(expected, actual, message); |
| 389 | } |
| 390 | |
| 391 | /** |
| 392 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 393 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 394 | */ |
| 395 | public static void assertEquals(short expected, short actual, Supplier<String> messageSupplier) { |
| 396 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 397 | } |
| 398 | |
| 399 | /** |
| 400 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 401 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 402 | */ |
| 403 | public static void assertEquals(short expected, Short actual, Supplier<String> messageSupplier) { |
| 404 | AssertEquals.assertEquals((Short) expected, actual, messageSupplier); |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 409 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 410 | */ |
| 411 | public static void assertEquals(Short expected, short actual, Supplier<String> messageSupplier) { |
| 412 | AssertEquals.assertEquals(expected, (Short) actual, messageSupplier); |
| 413 | } |
| 414 | |
| 415 | /** |
| 416 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 417 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 418 | * |
| 419 | * @since 5.4 |
| 420 | */ |
| 421 | @API(status = STABLE, since = "5.4") |
| 422 | public static void assertEquals(Short expected, Short actual, Supplier<String> messageSupplier) { |
| 423 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 424 | } |
| 425 | |
| 426 | /** |
| 427 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 428 | */ |
| 429 | public static void assertEquals(byte expected, byte actual) { |
| 430 | AssertEquals.assertEquals(expected, actual); |
| 431 | } |
| 432 | |
| 433 | /** |
| 434 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 435 | */ |
| 436 | public static void assertEquals(byte expected, Byte actual) { |
| 437 | AssertEquals.assertEquals((Byte) expected, actual); |
| 438 | } |
| 439 | |
| 440 | /** |
| 441 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 442 | */ |
| 443 | public static void assertEquals(Byte expected, byte actual) { |
| 444 | AssertEquals.assertEquals(expected, (Byte) actual); |
| 445 | } |
| 446 | |
| 447 | /** |
| 448 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 449 | * |
| 450 | * @since 5.4 |
| 451 | */ |
| 452 | @API(status = STABLE, since = "5.4") |
| 453 | public static void assertEquals(Byte expected, Byte actual) { |
| 454 | AssertEquals.assertEquals(expected, actual); |
| 455 | } |
| 456 | |
| 457 | /** |
| 458 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 459 | * <p>Fails with the supplied failure {@code message}. |
| 460 | */ |
| 461 | public static void assertEquals(byte expected, byte actual, String message) { |
| 462 | AssertEquals.assertEquals(expected, actual, message); |
| 463 | } |
| 464 | |
| 465 | /** |
| 466 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 467 | * <p>Fails with the supplied failure {@code message}. |
| 468 | */ |
| 469 | public static void assertEquals(byte expected, Byte actual, String message) { |
| 470 | AssertEquals.assertEquals((Byte) expected, actual, message); |
| 471 | } |
| 472 | |
| 473 | /** |
| 474 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 475 | * <p>Fails with the supplied failure {@code message}. |
| 476 | */ |
| 477 | public static void assertEquals(Byte expected, byte actual, String message) { |
| 478 | AssertEquals.assertEquals(expected, (Byte) actual, message); |
| 479 | } |
| 480 | |
| 481 | /** |
| 482 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 483 | * <p>Fails with the supplied failure {@code message}. |
| 484 | * |
| 485 | * @since 5.4 |
| 486 | */ |
| 487 | @API(status = STABLE, since = "5.4") |
| 488 | public static void assertEquals(Byte expected, Byte actual, String message) { |
| 489 | AssertEquals.assertEquals(expected, actual, message); |
| 490 | } |
| 491 | |
| 492 | /** |
| 493 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 494 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 495 | */ |
| 496 | public static void assertEquals(byte expected, byte actual, Supplier<String> messageSupplier) { |
| 497 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 498 | } |
| 499 | |
| 500 | /** |
| 501 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 502 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 503 | */ |
| 504 | public static void assertEquals(byte expected, Byte actual, Supplier<String> messageSupplier) { |
| 505 | AssertEquals.assertEquals((Byte) expected, actual, messageSupplier); |
| 506 | } |
| 507 | |
| 508 | /** |
| 509 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 510 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 511 | */ |
| 512 | public static void assertEquals(Byte expected, byte actual, Supplier<String> messageSupplier) { |
| 513 | AssertEquals.assertEquals(expected, (Byte) actual, messageSupplier); |
| 514 | } |
| 515 | |
| 516 | /** |
| 517 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 518 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 519 | * |
| 520 | * @since 5.4 |
| 521 | */ |
| 522 | @API(status = STABLE, since = "5.4") |
| 523 | public static void assertEquals(Byte expected, Byte actual, Supplier<String> messageSupplier) { |
| 524 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 525 | } |
| 526 | |
| 527 | /** |
| 528 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 529 | */ |
| 530 | public static void assertEquals(int expected, int actual) { |
| 531 | AssertEquals.assertEquals(expected, actual); |
| 532 | } |
| 533 | |
| 534 | /** |
| 535 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 536 | */ |
| 537 | public static void assertEquals(int expected, Integer actual) { |
| 538 | AssertEquals.assertEquals((Integer) expected, actual); |
| 539 | } |
| 540 | |
| 541 | /** |
| 542 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 543 | */ |
| 544 | public static void assertEquals(Integer expected, int actual) { |
| 545 | AssertEquals.assertEquals(expected, (Integer) actual); |
| 546 | } |
| 547 | |
| 548 | /** |
| 549 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 550 | * |
| 551 | * @since 5.4 |
| 552 | */ |
| 553 | @API(status = STABLE, since = "5.4") |
| 554 | public static void assertEquals(Integer expected, Integer actual) { |
| 555 | AssertEquals.assertEquals(expected, actual); |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 560 | * <p>Fails with the supplied failure {@code message}. |
| 561 | */ |
| 562 | public static void assertEquals(int expected, int actual, String message) { |
| 563 | AssertEquals.assertEquals(expected, actual, message); |
| 564 | } |
| 565 | |
| 566 | /** |
| 567 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 568 | * <p>Fails with the supplied failure {@code message}. |
| 569 | */ |
| 570 | public static void assertEquals(int expected, Integer actual, String message) { |
| 571 | AssertEquals.assertEquals((Integer) expected, actual, message); |
| 572 | } |
| 573 | |
| 574 | /** |
| 575 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 576 | * <p>Fails with the supplied failure {@code message}. |
| 577 | */ |
| 578 | public static void assertEquals(Integer expected, int actual, String message) { |
| 579 | AssertEquals.assertEquals(expected, (Integer) actual, message); |
| 580 | } |
| 581 | |
| 582 | /** |
| 583 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 584 | * <p>Fails with the supplied failure {@code message}. |
| 585 | * |
| 586 | * @since 5.4 |
| 587 | */ |
| 588 | @API(status = STABLE, since = "5.4") |
| 589 | public static void assertEquals(Integer expected, Integer actual, String message) { |
| 590 | AssertEquals.assertEquals(expected, actual, message); |
| 591 | } |
| 592 | |
| 593 | /** |
| 594 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 595 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 596 | */ |
| 597 | public static void assertEquals(int expected, int actual, Supplier<String> messageSupplier) { |
| 598 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 599 | } |
| 600 | |
| 601 | /** |
| 602 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 603 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 604 | */ |
| 605 | public static void assertEquals(int expected, Integer actual, Supplier<String> messageSupplier) { |
| 606 | AssertEquals.assertEquals((Integer) expected, actual, messageSupplier); |
| 607 | } |
| 608 | |
| 609 | /** |
| 610 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 611 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 612 | */ |
| 613 | public static void assertEquals(Integer expected, int actual, Supplier<String> messageSupplier) { |
| 614 | AssertEquals.assertEquals(expected, (Integer) actual, messageSupplier); |
| 615 | } |
| 616 | |
| 617 | /** |
| 618 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 619 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 620 | * |
| 621 | * @since 5.4 |
| 622 | */ |
| 623 | @API(status = STABLE, since = "5.4") |
| 624 | public static void assertEquals(Integer expected, Integer actual, Supplier<String> messageSupplier) { |
| 625 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 626 | } |
| 627 | |
| 628 | /** |
| 629 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 630 | */ |
| 631 | public static void assertEquals(long expected, long actual) { |
| 632 | AssertEquals.assertEquals(expected, actual); |
| 633 | } |
| 634 | |
| 635 | /** |
| 636 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 637 | */ |
| 638 | public static void assertEquals(long expected, Long actual) { |
| 639 | AssertEquals.assertEquals((Long) expected, actual); |
| 640 | } |
| 641 | |
| 642 | /** |
| 643 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 644 | */ |
| 645 | public static void assertEquals(Long expected, long actual) { |
| 646 | AssertEquals.assertEquals(expected, (Long) actual); |
| 647 | } |
| 648 | |
| 649 | /** |
| 650 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 651 | * |
| 652 | * @since 5.4 |
| 653 | */ |
| 654 | @API(status = STABLE, since = "5.4") |
| 655 | public static void assertEquals(Long expected, Long actual) { |
| 656 | AssertEquals.assertEquals(expected, actual); |
| 657 | } |
| 658 | |
| 659 | /** |
| 660 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 661 | * <p>Fails with the supplied failure {@code message}. |
| 662 | */ |
| 663 | public static void assertEquals(long expected, long actual, String message) { |
| 664 | AssertEquals.assertEquals(expected, actual, message); |
| 665 | } |
| 666 | |
| 667 | /** |
| 668 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 669 | * <p>Fails with the supplied failure {@code message}. |
| 670 | */ |
| 671 | public static void assertEquals(long expected, Long actual, String message) { |
| 672 | AssertEquals.assertEquals((Long) expected, actual, message); |
| 673 | } |
| 674 | |
| 675 | /** |
| 676 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 677 | * <p>Fails with the supplied failure {@code message}. |
| 678 | */ |
| 679 | public static void assertEquals(Long expected, long actual, String message) { |
| 680 | AssertEquals.assertEquals(expected, (Long) actual, message); |
| 681 | } |
| 682 | |
| 683 | /** |
| 684 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 685 | * <p>Fails with the supplied failure {@code message}. |
| 686 | * |
| 687 | * @since 5.4 |
| 688 | */ |
| 689 | @API(status = STABLE, since = "5.4") |
| 690 | public static void assertEquals(Long expected, Long actual, String message) { |
| 691 | AssertEquals.assertEquals(expected, actual, message); |
| 692 | } |
| 693 | |
| 694 | /** |
| 695 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 696 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 697 | */ |
| 698 | public static void assertEquals(long expected, long actual, Supplier<String> messageSupplier) { |
| 699 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 700 | } |
| 701 | |
| 702 | /** |
| 703 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 704 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 705 | */ |
| 706 | public static void assertEquals(long expected, Long actual, Supplier<String> messageSupplier) { |
| 707 | AssertEquals.assertEquals((Long) expected, actual, messageSupplier); |
| 708 | } |
| 709 | |
| 710 | /** |
| 711 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 712 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 713 | */ |
| 714 | public static void assertEquals(Long expected, long actual, Supplier<String> messageSupplier) { |
| 715 | AssertEquals.assertEquals(expected, (Long) actual, messageSupplier); |
| 716 | } |
| 717 | |
| 718 | /** |
| 719 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 720 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 721 | * |
| 722 | * @since 5.4 |
| 723 | */ |
| 724 | @API(status = STABLE, since = "5.4") |
| 725 | public static void assertEquals(Long expected, Long actual, Supplier<String> messageSupplier) { |
| 726 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 727 | } |
| 728 | |
| 729 | /** |
| 730 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 731 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 732 | * {@link Float#compare(float, float)}. |
| 733 | */ |
| 734 | public static void assertEquals(float expected, float actual) { |
| 735 | AssertEquals.assertEquals(expected, actual); |
| 736 | } |
| 737 | |
| 738 | /** |
| 739 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 740 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 741 | * {@link Float#compare(float, float)}. |
| 742 | */ |
| 743 | public static void assertEquals(float expected, Float actual) { |
| 744 | AssertEquals.assertEquals((Float) expected, actual); |
| 745 | } |
| 746 | |
| 747 | /** |
| 748 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 749 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 750 | * {@link Float#compare(float, float)}. |
| 751 | */ |
| 752 | public static void assertEquals(Float expected, float actual) { |
| 753 | AssertEquals.assertEquals(expected, (Float) actual); |
| 754 | } |
| 755 | |
| 756 | /** |
| 757 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 758 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 759 | * {@link Float#compare(float, float)}. |
| 760 | * |
| 761 | * @since 5.4 |
| 762 | */ |
| 763 | @API(status = STABLE, since = "5.4") |
| 764 | public static void assertEquals(Float expected, Float actual) { |
| 765 | AssertEquals.assertEquals(expected, actual); |
| 766 | } |
| 767 | |
| 768 | /** |
| 769 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 770 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 771 | * {@link Float#compare(float, float)}. |
| 772 | * <p>Fails with the supplied failure {@code message}. |
| 773 | */ |
| 774 | public static void assertEquals(float expected, float actual, String message) { |
| 775 | AssertEquals.assertEquals(expected, actual, message); |
| 776 | } |
| 777 | |
| 778 | /** |
| 779 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 780 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 781 | * {@link Float#compare(float, float)}. |
| 782 | * <p>Fails with the supplied failure {@code message}. |
| 783 | */ |
| 784 | public static void assertEquals(float expected, Float actual, String message) { |
| 785 | AssertEquals.assertEquals((Float) expected, actual, message); |
| 786 | } |
| 787 | |
| 788 | /** |
| 789 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 790 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 791 | * {@link Float#compare(float, float)}. |
| 792 | * <p>Fails with the supplied failure {@code message}. |
| 793 | */ |
| 794 | public static void assertEquals(Float expected, float actual, String message) { |
| 795 | AssertEquals.assertEquals(expected, (Float) actual, message); |
| 796 | } |
| 797 | |
| 798 | /** |
| 799 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 800 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 801 | * {@link Float#compare(float, float)}. |
| 802 | * <p>Fails with the supplied failure {@code message}. |
| 803 | * |
| 804 | * @since 5.4 |
| 805 | */ |
| 806 | @API(status = STABLE, since = "5.4") |
| 807 | public static void assertEquals(Float expected, Float actual, String message) { |
| 808 | AssertEquals.assertEquals(expected, actual, message); |
| 809 | } |
| 810 | |
| 811 | /** |
| 812 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 813 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 814 | * {@link Float#compare(float, float)}. |
| 815 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 816 | */ |
| 817 | public static void assertEquals(float expected, float actual, Supplier<String> messageSupplier) { |
| 818 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 819 | } |
| 820 | |
| 821 | /** |
| 822 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 823 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 824 | * {@link Float#compare(float, float)}. |
| 825 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 826 | */ |
| 827 | public static void assertEquals(float expected, Float actual, Supplier<String> messageSupplier) { |
| 828 | AssertEquals.assertEquals((Float) expected, actual, messageSupplier); |
| 829 | } |
| 830 | |
| 831 | /** |
| 832 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 833 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 834 | * {@link Float#compare(float, float)}. |
| 835 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 836 | */ |
| 837 | public static void assertEquals(Float expected, float actual, Supplier<String> messageSupplier) { |
| 838 | AssertEquals.assertEquals(expected, (Float) actual, messageSupplier); |
| 839 | } |
| 840 | |
| 841 | /** |
| 842 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 843 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 844 | * {@link Float#compare(float, float)}. |
| 845 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 846 | * |
| 847 | * @since 5.4 |
| 848 | */ |
| 849 | @API(status = STABLE, since = "5.4") |
| 850 | public static void assertEquals(Float expected, Float actual, Supplier<String> messageSupplier) { |
| 851 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 852 | } |
| 853 | |
| 854 | /** |
| 855 | * <em>Assert</em> that {@code expected} and {@code actual} are equal within the given non-negative {@code delta}. |
| 856 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 857 | * {@link Float#compare(float, float)}. |
| 858 | */ |
| 859 | public static void assertEquals(float expected, float actual, float delta) { |
| 860 | AssertEquals.assertEquals(expected, actual, delta); |
| 861 | } |
| 862 | |
| 863 | /** |
| 864 | * <em>Assert</em> that {@code expected} and {@code actual} are equal within the given non-negative {@code delta}. |
| 865 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 866 | * {@link Float#compare(float, float)}. |
| 867 | * <p>Fails with the supplied failure {@code message}. |
| 868 | */ |
| 869 | public static void assertEquals(float expected, float actual, float delta, String message) { |
| 870 | AssertEquals.assertEquals(expected, actual, delta, message); |
| 871 | } |
| 872 | |
| 873 | /** |
| 874 | * <em>Assert</em> that {@code expected} and {@code actual} are equal within the given non-negative {@code delta}. |
| 875 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 876 | * {@link Float#compare(float, float)}. |
| 877 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 878 | */ |
| 879 | public static void assertEquals(float expected, float actual, float delta, Supplier<String> messageSupplier) { |
| 880 | AssertEquals.assertEquals(expected, actual, delta, messageSupplier); |
| 881 | } |
| 882 | |
| 883 | /** |
| 884 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 885 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 886 | * {@link Double#compare(double, double)}. |
| 887 | */ |
| 888 | public static void assertEquals(double expected, double actual) { |
| 889 | AssertEquals.assertEquals(expected, actual); |
| 890 | } |
| 891 | |
| 892 | /** |
| 893 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 894 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 895 | * {@link Double#compare(double, double)}. |
| 896 | */ |
| 897 | public static void assertEquals(double expected, Double actual) { |
| 898 | AssertEquals.assertEquals((Double) expected, actual); |
| 899 | } |
| 900 | |
| 901 | /** |
| 902 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 903 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 904 | * {@link Double#compare(double, double)}. |
| 905 | */ |
| 906 | public static void assertEquals(Double expected, double actual) { |
| 907 | AssertEquals.assertEquals(expected, (Double) actual); |
| 908 | } |
| 909 | |
| 910 | /** |
| 911 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 912 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 913 | * {@link Double#compare(double, double)}. |
| 914 | * |
| 915 | * @since 5.4 |
| 916 | */ |
| 917 | @API(status = STABLE, since = "5.4") |
| 918 | public static void assertEquals(Double expected, Double actual) { |
| 919 | AssertEquals.assertEquals(expected, actual); |
| 920 | } |
| 921 | |
| 922 | /** |
| 923 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 924 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 925 | * {@link Double#compare(double, double)}. |
| 926 | * <p>Fails with the supplied failure {@code message}. |
| 927 | */ |
| 928 | public static void assertEquals(double expected, double actual, String message) { |
| 929 | AssertEquals.assertEquals(expected, actual, message); |
| 930 | } |
| 931 | |
| 932 | /** |
| 933 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 934 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 935 | * {@link Double#compare(double, double)}. |
| 936 | * <p>Fails with the supplied failure {@code message}. |
| 937 | */ |
| 938 | public static void assertEquals(double expected, Double actual, String message) { |
| 939 | AssertEquals.assertEquals((Double) expected, actual, message); |
| 940 | } |
| 941 | |
| 942 | /** |
| 943 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 944 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 945 | * {@link Double#compare(double, double)}. |
| 946 | * <p>Fails with the supplied failure {@code message}. |
| 947 | */ |
| 948 | public static void assertEquals(Double expected, double actual, String message) { |
| 949 | AssertEquals.assertEquals(expected, (Double) actual, message); |
| 950 | } |
| 951 | |
| 952 | /** |
| 953 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 954 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 955 | * {@link Double#compare(double, double)}. |
| 956 | * <p>Fails with the supplied failure {@code message}. |
| 957 | * |
| 958 | * @since 5.4 |
| 959 | */ |
| 960 | @API(status = STABLE, since = "5.4") |
| 961 | public static void assertEquals(Double expected, Double actual, String message) { |
| 962 | AssertEquals.assertEquals(expected, actual, message); |
| 963 | } |
| 964 | |
| 965 | /** |
| 966 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 967 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 968 | * {@link Double#compare(double, double)}. |
| 969 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 970 | */ |
| 971 | public static void assertEquals(double expected, double actual, Supplier<String> messageSupplier) { |
| 972 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 973 | } |
| 974 | |
| 975 | /** |
| 976 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 977 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 978 | * {@link Double#compare(double, double)}. |
| 979 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 980 | */ |
| 981 | public static void assertEquals(double expected, Double actual, Supplier<String> messageSupplier) { |
| 982 | AssertEquals.assertEquals((Double) expected, actual, messageSupplier); |
| 983 | } |
| 984 | |
| 985 | /** |
| 986 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 987 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 988 | * {@link Double#compare(double, double)}. |
| 989 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 990 | */ |
| 991 | public static void assertEquals(Double expected, double actual, Supplier<String> messageSupplier) { |
| 992 | AssertEquals.assertEquals(expected, (Double) actual, messageSupplier); |
| 993 | } |
| 994 | |
| 995 | /** |
| 996 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 997 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 998 | * {@link Double#compare(double, double)}. |
| 999 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1000 | * |
| 1001 | * @since 5.4 |
| 1002 | */ |
| 1003 | @API(status = STABLE, since = "5.4") |
| 1004 | public static void assertEquals(Double expected, Double actual, Supplier<String> messageSupplier) { |
| 1005 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 1006 | } |
| 1007 | |
| 1008 | /** |
| 1009 | * <em>Assert</em> that {@code expected} and {@code actual} are equal within the given non-negative {@code delta}. |
| 1010 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 1011 | * {@link Double#compare(double, double)}. |
| 1012 | */ |
| 1013 | public static void assertEquals(double expected, double actual, double delta) { |
| 1014 | AssertEquals.assertEquals(expected, actual, delta); |
| 1015 | } |
| 1016 | |
| 1017 | /** |
| 1018 | * <em>Assert</em> that {@code expected} and {@code actual} are equal within the given non-negative {@code delta}. |
| 1019 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 1020 | * {@link Double#compare(double, double)}. |
| 1021 | * <p>Fails with the supplied failure {@code message}. |
| 1022 | */ |
| 1023 | public static void assertEquals(double expected, double actual, double delta, String message) { |
| 1024 | AssertEquals.assertEquals(expected, actual, delta, message); |
| 1025 | } |
| 1026 | |
| 1027 | /** |
| 1028 | * <em>Assert</em> that {@code expected} and {@code actual} are equal within the given non-negative {@code delta}. |
| 1029 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 1030 | * {@link Double#compare(double, double)}. |
| 1031 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1032 | */ |
| 1033 | public static void assertEquals(double expected, double actual, double delta, Supplier<String> messageSupplier) { |
| 1034 | AssertEquals.assertEquals(expected, actual, delta, messageSupplier); |
| 1035 | } |
| 1036 | |
| 1037 | /** |
| 1038 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1039 | */ |
| 1040 | public static void assertEquals(char expected, char actual) { |
| 1041 | AssertEquals.assertEquals(expected, actual); |
| 1042 | } |
| 1043 | |
| 1044 | /** |
| 1045 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1046 | */ |
| 1047 | public static void assertEquals(char expected, Character actual) { |
| 1048 | AssertEquals.assertEquals((Character) expected, actual); |
| 1049 | } |
| 1050 | |
| 1051 | /** |
| 1052 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1053 | */ |
| 1054 | public static void assertEquals(Character expected, char actual) { |
| 1055 | AssertEquals.assertEquals(expected, (Character) actual); |
| 1056 | } |
| 1057 | |
| 1058 | /** |
| 1059 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1060 | * |
| 1061 | * @since 5.4 |
| 1062 | */ |
| 1063 | @API(status = STABLE, since = "5.4") |
| 1064 | public static void assertEquals(Character expected, Character actual) { |
| 1065 | AssertEquals.assertEquals(expected, actual); |
| 1066 | } |
| 1067 | |
| 1068 | /** |
| 1069 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1070 | * <p>Fails with the supplied failure {@code message}. |
| 1071 | */ |
| 1072 | public static void assertEquals(char expected, char actual, String message) { |
| 1073 | AssertEquals.assertEquals(expected, actual, message); |
| 1074 | } |
| 1075 | |
| 1076 | /** |
| 1077 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1078 | * <p>Fails with the supplied failure {@code message}. |
| 1079 | */ |
| 1080 | public static void assertEquals(char expected, Character actual, String message) { |
| 1081 | AssertEquals.assertEquals((Character) expected, actual, message); |
| 1082 | } |
| 1083 | |
| 1084 | /** |
| 1085 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1086 | * <p>Fails with the supplied failure {@code message}. |
| 1087 | */ |
| 1088 | public static void assertEquals(Character expected, char actual, String message) { |
| 1089 | AssertEquals.assertEquals(expected, (Character) actual, message); |
| 1090 | } |
| 1091 | |
| 1092 | /** |
| 1093 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1094 | * <p>Fails with the supplied failure {@code message}. |
| 1095 | * |
| 1096 | * @since 5.4 |
| 1097 | */ |
| 1098 | @API(status = STABLE, since = "5.4") |
| 1099 | public static void assertEquals(Character expected, Character actual, String message) { |
| 1100 | AssertEquals.assertEquals(expected, actual, message); |
| 1101 | } |
| 1102 | |
| 1103 | /** |
| 1104 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1105 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1106 | */ |
| 1107 | public static void assertEquals(char expected, char actual, Supplier<String> messageSupplier) { |
| 1108 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 1109 | } |
| 1110 | |
| 1111 | /** |
| 1112 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1113 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1114 | */ |
| 1115 | public static void assertEquals(char expected, Character actual, Supplier<String> messageSupplier) { |
| 1116 | AssertEquals.assertEquals((Character) expected, actual, messageSupplier); |
| 1117 | } |
| 1118 | |
| 1119 | /** |
| 1120 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1121 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1122 | */ |
| 1123 | public static void assertEquals(Character expected, char actual, Supplier<String> messageSupplier) { |
| 1124 | AssertEquals.assertEquals(expected, (Character) actual, messageSupplier); |
| 1125 | } |
| 1126 | |
| 1127 | /** |
| 1128 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1129 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1130 | * |
| 1131 | * @since 5.4 |
| 1132 | */ |
| 1133 | @API(status = STABLE, since = "5.4") |
| 1134 | public static void assertEquals(Character expected, Character actual, Supplier<String> messageSupplier) { |
| 1135 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 1136 | } |
| 1137 | |
| 1138 | /** |
| 1139 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1140 | * <p>If both are {@code null}, they are considered equal. |
| 1141 | * |
| 1142 | * @see Object#equals(Object) |
| 1143 | */ |
| 1144 | public static void assertEquals(Object expected, Object actual) { |
| 1145 | AssertEquals.assertEquals(expected, actual); |
| 1146 | } |
| 1147 | |
| 1148 | /** |
| 1149 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1150 | * <p>If both are {@code null}, they are considered equal. |
| 1151 | * <p>Fails with the supplied failure {@code message}. |
| 1152 | * |
| 1153 | * @see Object#equals(Object) |
| 1154 | */ |
| 1155 | public static void assertEquals(Object expected, Object actual, String message) { |
| 1156 | AssertEquals.assertEquals(expected, actual, message); |
| 1157 | } |
| 1158 | |
| 1159 | /** |
| 1160 | * <em>Assert</em> that {@code expected} and {@code actual} are equal. |
| 1161 | * <p>If both are {@code null}, they are considered equal. |
| 1162 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1163 | * |
| 1164 | * @see Object#equals(Object) |
| 1165 | */ |
| 1166 | public static void assertEquals(Object expected, Object actual, Supplier<String> messageSupplier) { |
| 1167 | AssertEquals.assertEquals(expected, actual, messageSupplier); |
| 1168 | } |
| 1169 | |
| 1170 | // --- assertArrayEquals --------------------------------------------------- |
| 1171 | |
| 1172 | /** |
| 1173 | * <em>Assert</em> that {@code expected} and {@code actual} boolean arrays are equal. |
| 1174 | * <p>If both are {@code null}, they are considered equal. |
| 1175 | */ |
| 1176 | public static void assertArrayEquals(boolean[] expected, boolean[] actual) { |
| 1177 | AssertArrayEquals.assertArrayEquals(expected, actual); |
| 1178 | } |
| 1179 | |
| 1180 | /** |
| 1181 | * <em>Assert</em> that {@code expected} and {@code actual} boolean arrays are equal. |
| 1182 | * <p>If both are {@code null}, they are considered equal. |
| 1183 | * <p>Fails with the supplied failure {@code message}. |
| 1184 | */ |
| 1185 | public static void assertArrayEquals(boolean[] expected, boolean[] actual, String message) { |
| 1186 | AssertArrayEquals.assertArrayEquals(expected, actual, message); |
| 1187 | } |
| 1188 | |
| 1189 | /** |
| 1190 | * <em>Assert</em> that {@code expected} and {@code actual} boolean arrays are equal. |
| 1191 | * <p>If both are {@code null}, they are considered equal. |
| 1192 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1193 | */ |
| 1194 | public static void assertArrayEquals(boolean[] expected, boolean[] actual, Supplier<String> messageSupplier) { |
| 1195 | AssertArrayEquals.assertArrayEquals(expected, actual, messageSupplier); |
| 1196 | } |
| 1197 | |
| 1198 | /** |
| 1199 | * <em>Assert</em> that {@code expected} and {@code actual} char arrays are equal. |
| 1200 | * <p>If both are {@code null}, they are considered equal. |
| 1201 | */ |
| 1202 | public static void assertArrayEquals(char[] expected, char[] actual) { |
| 1203 | AssertArrayEquals.assertArrayEquals(expected, actual); |
| 1204 | } |
| 1205 | |
| 1206 | /** |
| 1207 | * <em>Assert</em> that {@code expected} and {@code actual} char arrays are equal. |
| 1208 | * <p>If both are {@code null}, they are considered equal. |
| 1209 | * <p>Fails with the supplied failure {@code message}. |
| 1210 | */ |
| 1211 | public static void assertArrayEquals(char[] expected, char[] actual, String message) { |
| 1212 | AssertArrayEquals.assertArrayEquals(expected, actual, message); |
| 1213 | } |
| 1214 | |
| 1215 | /** |
| 1216 | * <em>Assert</em> that {@code expected} and {@code actual} char arrays are equal. |
| 1217 | * <p>If both are {@code null}, they are considered equal. |
| 1218 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1219 | */ |
| 1220 | public static void assertArrayEquals(char[] expected, char[] actual, Supplier<String> messageSupplier) { |
| 1221 | AssertArrayEquals.assertArrayEquals(expected, actual, messageSupplier); |
| 1222 | } |
| 1223 | |
| 1224 | /** |
| 1225 | * <em>Assert</em> that {@code expected} and {@code actual} byte arrays are equal. |
| 1226 | * <p>If both are {@code null}, they are considered equal. |
| 1227 | */ |
| 1228 | public static void assertArrayEquals(byte[] expected, byte[] actual) { |
| 1229 | AssertArrayEquals.assertArrayEquals(expected, actual); |
| 1230 | } |
| 1231 | |
| 1232 | /** |
| 1233 | * <em>Assert</em> that {@code expected} and {@code actual} byte arrays are equal. |
| 1234 | * <p>If both are {@code null}, they are considered equal. |
| 1235 | * <p>Fails with the supplied failure {@code message}. |
| 1236 | */ |
| 1237 | public static void assertArrayEquals(byte[] expected, byte[] actual, String message) { |
| 1238 | AssertArrayEquals.assertArrayEquals(expected, actual, message); |
| 1239 | } |
| 1240 | |
| 1241 | /** |
| 1242 | * <em>Assert</em> that {@code expected} and {@code actual} byte arrays are equal. |
| 1243 | * <p>If both are {@code null}, they are considered equal. |
| 1244 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1245 | */ |
| 1246 | public static void assertArrayEquals(byte[] expected, byte[] actual, Supplier<String> messageSupplier) { |
| 1247 | AssertArrayEquals.assertArrayEquals(expected, actual, messageSupplier); |
| 1248 | } |
| 1249 | |
| 1250 | /** |
| 1251 | * <em>Assert</em> that {@code expected} and {@code actual} short arrays are equal. |
| 1252 | * <p>If both are {@code null}, they are considered equal. |
| 1253 | */ |
| 1254 | public static void assertArrayEquals(short[] expected, short[] actual) { |
| 1255 | AssertArrayEquals.assertArrayEquals(expected, actual); |
| 1256 | } |
| 1257 | |
| 1258 | /** |
| 1259 | * <em>Assert</em> that {@code expected} and {@code actual} short arrays are equal. |
| 1260 | * <p>If both are {@code null}, they are considered equal. |
| 1261 | * <p>Fails with the supplied failure {@code message}. |
| 1262 | */ |
| 1263 | public static void assertArrayEquals(short[] expected, short[] actual, String message) { |
| 1264 | AssertArrayEquals.assertArrayEquals(expected, actual, message); |
| 1265 | } |
| 1266 | |
| 1267 | /** |
| 1268 | * <em>Assert</em> that {@code expected} and {@code actual} short arrays are equal. |
| 1269 | * <p>If both are {@code null}, they are considered equal. |
| 1270 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1271 | */ |
| 1272 | public static void assertArrayEquals(short[] expected, short[] actual, Supplier<String> messageSupplier) { |
| 1273 | AssertArrayEquals.assertArrayEquals(expected, actual, messageSupplier); |
| 1274 | } |
| 1275 | |
| 1276 | /** |
| 1277 | * <em>Assert</em> that {@code expected} and {@code actual} int arrays are equal. |
| 1278 | * <p>If both are {@code null}, they are considered equal. |
| 1279 | */ |
| 1280 | public static void assertArrayEquals(int[] expected, int[] actual) { |
| 1281 | AssertArrayEquals.assertArrayEquals(expected, actual); |
| 1282 | } |
| 1283 | |
| 1284 | /** |
| 1285 | * <em>Assert</em> that {@code expected} and {@code actual} int arrays are equal. |
| 1286 | * <p>If both are {@code null}, they are considered equal. |
| 1287 | * <p>Fails with the supplied failure {@code message}. |
| 1288 | */ |
| 1289 | public static void assertArrayEquals(int[] expected, int[] actual, String message) { |
| 1290 | AssertArrayEquals.assertArrayEquals(expected, actual, message); |
| 1291 | } |
| 1292 | |
| 1293 | /** |
| 1294 | * <em>Assert</em> that {@code expected} and {@code actual} int arrays are equal. |
| 1295 | * <p>If both are {@code null}, they are considered equal. |
| 1296 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1297 | */ |
| 1298 | public static void assertArrayEquals(int[] expected, int[] actual, Supplier<String> messageSupplier) { |
| 1299 | AssertArrayEquals.assertArrayEquals(expected, actual, messageSupplier); |
| 1300 | } |
| 1301 | |
| 1302 | /** |
| 1303 | * <em>Assert</em> that {@code expected} and {@code actual} long arrays are equal. |
| 1304 | * <p>If both are {@code null}, they are considered equal. |
| 1305 | */ |
| 1306 | public static void assertArrayEquals(long[] expected, long[] actual) { |
| 1307 | AssertArrayEquals.assertArrayEquals(expected, actual); |
| 1308 | } |
| 1309 | |
| 1310 | /** |
| 1311 | * <em>Assert</em> that {@code expected} and {@code actual} long arrays are equal. |
| 1312 | * <p>If both are {@code null}, they are considered equal. |
| 1313 | * <p>Fails with the supplied failure {@code message}. |
| 1314 | */ |
| 1315 | public static void assertArrayEquals(long[] expected, long[] actual, String message) { |
| 1316 | AssertArrayEquals.assertArrayEquals(expected, actual, message); |
| 1317 | } |
| 1318 | |
| 1319 | /** |
| 1320 | * <em>Assert</em> that {@code expected} and {@code actual} long arrays are equal. |
| 1321 | * <p>If both are {@code null}, they are considered equal. |
| 1322 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1323 | */ |
| 1324 | public static void assertArrayEquals(long[] expected, long[] actual, Supplier<String> messageSupplier) { |
| 1325 | AssertArrayEquals.assertArrayEquals(expected, actual, messageSupplier); |
| 1326 | } |
| 1327 | |
| 1328 | /** |
| 1329 | * <em>Assert</em> that {@code expected} and {@code actual} float arrays are equal. |
| 1330 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 1331 | * {@link Float#compare(float, float)}. |
| 1332 | */ |
| 1333 | public static void assertArrayEquals(float[] expected, float[] actual) { |
| 1334 | AssertArrayEquals.assertArrayEquals(expected, actual); |
| 1335 | } |
| 1336 | |
| 1337 | /** |
| 1338 | * <em>Assert</em> that {@code expected} and {@code actual} float arrays are equal. |
| 1339 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 1340 | * {@link Float#compare(float, float)}. |
| 1341 | * <p>Fails with the supplied failure {@code message}. |
| 1342 | */ |
| 1343 | public static void assertArrayEquals(float[] expected, float[] actual, String message) { |
| 1344 | AssertArrayEquals.assertArrayEquals(expected, actual, message); |
| 1345 | } |
| 1346 | |
| 1347 | /** |
| 1348 | * <em>Assert</em> that {@code expected} and {@code actual} float arrays are equal. |
| 1349 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 1350 | * {@link Float#compare(float, float)}. |
| 1351 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1352 | */ |
| 1353 | public static void assertArrayEquals(float[] expected, float[] actual, Supplier<String> messageSupplier) { |
| 1354 | AssertArrayEquals.assertArrayEquals(expected, actual, messageSupplier); |
| 1355 | } |
| 1356 | |
| 1357 | /** |
| 1358 | * <em>Assert</em> that {@code expected} and {@code actual} float arrays are equal within the given non-negative {@code delta}. |
| 1359 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 1360 | * {@link Float#compare(float, float)}. |
| 1361 | */ |
| 1362 | public static void assertArrayEquals(float[] expected, float[] actual, float delta) { |
| 1363 | AssertArrayEquals.assertArrayEquals(expected, actual, delta); |
| 1364 | } |
| 1365 | |
| 1366 | /** |
| 1367 | * <em>Assert</em> that {@code expected} and {@code actual} float arrays are equal within the given non-negative {@code delta}. |
| 1368 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 1369 | * {@link Float#compare(float, float)}. |
| 1370 | * <p>Fails with the supplied failure {@code message}. |
| 1371 | */ |
| 1372 | public static void assertArrayEquals(float[] expected, float[] actual, float delta, String message) { |
| 1373 | AssertArrayEquals.assertArrayEquals(expected, actual, delta, message); |
| 1374 | } |
| 1375 | |
| 1376 | /** |
| 1377 | * <em>Assert</em> that {@code expected} and {@code actual} float arrays are equal within the given non-negative {@code delta}. |
| 1378 | * <p>Equality imposed by this method is consistent with {@link Float#equals(Object)} and |
| 1379 | * {@link Float#compare(float, float)}. |
| 1380 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1381 | */ |
| 1382 | public static void assertArrayEquals(float[] expected, float[] actual, float delta, |
| 1383 | Supplier<String> messageSupplier) { |
| 1384 | AssertArrayEquals.assertArrayEquals(expected, actual, delta, messageSupplier); |
| 1385 | } |
| 1386 | |
| 1387 | /** |
| 1388 | * <em>Assert</em> that {@code expected} and {@code actual} double arrays are equal. |
| 1389 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 1390 | * {@link Double#compare(double, double)}. |
| 1391 | */ |
| 1392 | public static void assertArrayEquals(double[] expected, double[] actual) { |
| 1393 | AssertArrayEquals.assertArrayEquals(expected, actual); |
| 1394 | } |
| 1395 | |
| 1396 | /** |
| 1397 | * <em>Assert</em> that {@code expected} and {@code actual} double arrays are equal. |
| 1398 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 1399 | * {@link Double#compare(double, double)}. |
| 1400 | * <p>Fails with the supplied failure {@code message}. |
| 1401 | */ |
| 1402 | public static void assertArrayEquals(double[] expected, double[] actual, String message) { |
| 1403 | AssertArrayEquals.assertArrayEquals(expected, actual, message); |
| 1404 | } |
| 1405 | |
| 1406 | /** |
| 1407 | * <em>Assert</em> that {@code expected} and {@code actual} double arrays are equal. |
| 1408 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 1409 | * {@link Double#compare(double, double)}. |
| 1410 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1411 | */ |
| 1412 | public static void assertArrayEquals(double[] expected, double[] actual, Supplier<String> messageSupplier) { |
| 1413 | AssertArrayEquals.assertArrayEquals(expected, actual, messageSupplier); |
| 1414 | } |
| 1415 | |
| 1416 | /** |
| 1417 | * <em>Assert</em> that {@code expected} and {@code actual} double arrays are equal within the given non-negative {@code delta}. |
| 1418 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 1419 | * {@link Double#compare(double, double)}. |
| 1420 | */ |
| 1421 | public static void assertArrayEquals(double[] expected, double[] actual, double delta) { |
| 1422 | AssertArrayEquals.assertArrayEquals(expected, actual, delta); |
| 1423 | } |
| 1424 | |
| 1425 | /** |
| 1426 | * <em>Assert</em> that {@code expected} and {@code actual} double arrays are equal within the given non-negative {@code delta}. |
| 1427 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 1428 | * {@link Double#compare(double, double)}. |
| 1429 | * <p>Fails with the supplied failure {@code message}. |
| 1430 | */ |
| 1431 | public static void assertArrayEquals(double[] expected, double[] actual, double delta, String message) { |
| 1432 | AssertArrayEquals.assertArrayEquals(expected, actual, delta, message); |
| 1433 | } |
| 1434 | |
| 1435 | /** |
| 1436 | * <em>Assert</em> that {@code expected} and {@code actual} double arrays are equal within the given non-negative {@code delta}. |
| 1437 | * <p>Equality imposed by this method is consistent with {@link Double#equals(Object)} and |
| 1438 | * {@link Double#compare(double, double)}. |
| 1439 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1440 | */ |
| 1441 | public static void assertArrayEquals(double[] expected, double[] actual, double delta, |
| 1442 | Supplier<String> messageSupplier) { |
| 1443 | AssertArrayEquals.assertArrayEquals(expected, actual, delta, messageSupplier); |
| 1444 | } |
| 1445 | |
| 1446 | /** |
| 1447 | * <em>Assert</em> that {@code expected} and {@code actual} object arrays are deeply equal. |
| 1448 | * <p>If both are {@code null}, they are considered equal. |
| 1449 | * <p>Nested float arrays are checked as in {@link #assertEquals(float, float)}. |
| 1450 | * <p>Nested double arrays are checked as in {@link #assertEquals(double, double)}. |
| 1451 | * |
| 1452 | * @see Objects#equals(Object, Object) |
| 1453 | * @see Arrays#deepEquals(Object[], Object[]) |
| 1454 | */ |
| 1455 | public static void assertArrayEquals(Object[] expected, Object[] actual) { |
| 1456 | AssertArrayEquals.assertArrayEquals(expected, actual); |
| 1457 | } |
| 1458 | |
| 1459 | /** |
| 1460 | * <em>Assert</em> that {@code expected} and {@code actual} object arrays are deeply equal. |
| 1461 | * <p>If both are {@code null}, they are considered equal. |
| 1462 | * <p>Nested float arrays are checked as in {@link #assertEquals(float, float)}. |
| 1463 | * <p>Nested double arrays are checked as in {@link #assertEquals(double, double)}. |
| 1464 | * <p>Fails with the supplied failure {@code message}. |
| 1465 | * |
| 1466 | * @see Objects#equals(Object, Object) |
| 1467 | * @see Arrays#deepEquals(Object[], Object[]) |
| 1468 | */ |
| 1469 | public static void assertArrayEquals(Object[] expected, Object[] actual, String message) { |
| 1470 | AssertArrayEquals.assertArrayEquals(expected, actual, message); |
| 1471 | } |
| 1472 | |
| 1473 | /** |
| 1474 | * <em>Assert</em> that {@code expected} and {@code actual} object arrays are deeply equal. |
| 1475 | * <p>If both are {@code null}, they are considered equal. |
| 1476 | * <p>Nested float arrays are checked as in {@link #assertEquals(float, float)}. |
| 1477 | * <p>Nested double arrays are checked as in {@link #assertEquals(double, double)}. |
| 1478 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1479 | * |
| 1480 | * @see Objects#equals(Object, Object) |
| 1481 | * @see Arrays#deepEquals(Object[], Object[]) |
| 1482 | */ |
| 1483 | public static void assertArrayEquals(Object[] expected, Object[] actual, Supplier<String> messageSupplier) { |
| 1484 | AssertArrayEquals.assertArrayEquals(expected, actual, messageSupplier); |
| 1485 | } |
| 1486 | |
| 1487 | // --- assertIterableEquals -------------------------------------------- |
| 1488 | |
| 1489 | /** |
| 1490 | * <em>Assert</em> that {@code expected} and {@code actual} iterables are deeply equal. |
| 1491 | * <p>Similarly to the check for deep equality in {@link #assertArrayEquals(Object[], Object[])}, |
| 1492 | * if two iterables are encountered (including {@code expected} and {@code actual}) then their |
| 1493 | * iterators must return equal elements in the same order as each other. <strong>Note:</strong> |
| 1494 | * this means that the iterables <em>do not</em> need to be of the same type. Example: <pre>{@code |
| 1495 | * import static java.util.Arrays.asList; |
| 1496 | * . . . |
| 1497 | * Iterable<Integer> i0 = new ArrayList<>(asList(1, 2, 3)); |
| 1498 | * Iterable<Integer> i1 = new LinkedList<>(asList(1, 2, 3)); |
| 1499 | * assertIterableEquals(i0, i1); // Passes |
| 1500 | * }</pre> |
| 1501 | * <p>If both {@code expected} and {@code actual} are {@code null}, they are considered equal. |
| 1502 | * |
| 1503 | * @see Objects#equals(Object, Object) |
| 1504 | * @see Arrays#deepEquals(Object[], Object[]) |
| 1505 | * @see #assertArrayEquals(Object[], Object[]) |
| 1506 | */ |
| 1507 | public static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual) { |
| 1508 | AssertIterableEquals.assertIterableEquals(expected, actual); |
| 1509 | } |
| 1510 | |
| 1511 | /** |
| 1512 | * <em>Assert</em> that {@code expected} and {@code actual} iterables are deeply equal. |
| 1513 | * <p>Similarly to the check for deep equality in |
| 1514 | * {@link #assertArrayEquals(Object[], Object[], String)}, if two iterables are encountered |
| 1515 | * (including {@code expected} and {@code actual}) then their iterators must return equal |
| 1516 | * elements in the same order as each other. <strong>Note:</strong> this means that the iterables |
| 1517 | * <em>do not</em> need to be of the same type. Example: <pre>{@code |
| 1518 | * import static java.util.Arrays.asList; |
| 1519 | * . . . |
| 1520 | * Iterable<Integer> i0 = new ArrayList<>(asList(1, 2, 3)); |
| 1521 | * Iterable<Integer> i1 = new LinkedList<>(asList(1, 2, 3)); |
| 1522 | * assertIterableEquals(i0, i1); // Passes |
| 1523 | * }</pre> |
| 1524 | * <p>If both {@code expected} and {@code actual} are {@code null}, they are considered equal. |
| 1525 | * <p>Fails with the supplied failure {@code message}. |
| 1526 | * |
| 1527 | * @see Objects#equals(Object, Object) |
| 1528 | * @see Arrays#deepEquals(Object[], Object[]) |
| 1529 | * @see #assertArrayEquals(Object[], Object[], String) |
| 1530 | */ |
| 1531 | public static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual, String message) { |
| 1532 | AssertIterableEquals.assertIterableEquals(expected, actual, message); |
| 1533 | } |
| 1534 | |
| 1535 | /** |
| 1536 | * <em>Assert</em> that {@code expected} and {@code actual} iterables are deeply equal. |
| 1537 | * <p>Similarly to the check for deep equality in |
| 1538 | * {@link #assertArrayEquals(Object[], Object[], Supplier)}, if two iterables are encountered |
| 1539 | * (including {@code expected} and {@code actual}) then their iterators must return equal |
| 1540 | * elements in the same order as each other. <strong>Note:</strong> this means that the iterables |
| 1541 | * <em>do not</em> need to be of the same type. Example: <pre>{@code |
| 1542 | * import static java.util.Arrays.asList; |
| 1543 | * . . . |
| 1544 | * Iterable<Integer> i0 = new ArrayList<>(asList(1, 2, 3)); |
| 1545 | * Iterable<Integer> i1 = new LinkedList<>(asList(1, 2, 3)); |
| 1546 | * assertIterableEquals(i0, i1); // Passes |
| 1547 | * }</pre> |
| 1548 | * <p>If both {@code expected} and {@code actual} are {@code null}, they are considered equal. |
| 1549 | * <p>If necessary, the failure message will be retrieved lazily from the supplied {@code messageSupplier}. |
| 1550 | * |
| 1551 | * @see Objects#equals(Object, Object) |
| 1552 | * @see Arrays#deepEquals(Object[], Object[]) |
| 1553 | * @see #assertArrayEquals(Object[], Object[], Supplier) |
| 1554 | */ |
| 1555 | public static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual, |
| 1556 | Supplier<String> messageSupplier) { |
| 1557 | AssertIterableEquals.assertIterableEquals(expected, actual, messageSupplier); |
| 1558 | } |
| 1559 | |
| 1560 | // --- assertLinesMatch ---------------------------------------------------- |
| 1561 | |
| 1562 | /** |
| 1563 | * <em>Assert</em> that {@code expected} list of {@linkplain String}s matches {@code actual} |
| 1564 | * list. |
| 1565 | * |
| 1566 | * <p>This method differs from other assertions that effectively only check {@link String#equals(Object)}, |
| 1567 | * in that it uses the following staged matching algorithm: |
| 1568 | * |
| 1569 | * <p>For each pair of expected and actual lines do |
| 1570 | * <ol> |
| 1571 | * <li>check if {@code expected.equals(actual)} - if yes, continue with next pair</li> |
| 1572 | * <li>otherwise treat {@code expected} as a regular expression and check via |
| 1573 | * {@link String#matches(String)} - if yes, continue with next pair</li> |
| 1574 | * <li>otherwise check if {@code expected} line is a fast-forward marker, if yes apply |
| 1575 | * fast-forward actual lines accordingly (see below) and goto 1.</li> |
| 1576 | * </ol> |
| 1577 | * |
| 1578 | * <p>A valid fast-forward marker is an expected line that starts and ends with the literal |
| 1579 | * {@code >>} and contains at least 4 characters. Examples: |
| 1580 | * <ul> |
| 1581 | * <li>{@code >>>>}<br>{@code >> stacktrace >>}<br>{@code >> single line, non Integer.parse()-able comment >>} |
| 1582 | * <br>Skip arbitrary number of actual lines, until first matching subsequent expected line is found. Any |
| 1583 | * character between the fast-forward literals are discarded.</li> |
| 1584 | * <li>{@code ">> 21 >>"} |
| 1585 | * <br>Skip strictly 21 lines. If they can't be skipped for any reason, an assertion error is raised.</li> |
| 1586 | * </ul> |
| 1587 | * |
| 1588 | * <p>Here is an example showing all three kinds of expected line formats: |
| 1589 | * <pre>{@code |
| 1590 | * ls -la / |
| 1591 | * total [\d]+ |
| 1592 | * drwxr-xr-x 0 root root 512 Jan 1 1970 . |
| 1593 | * drwxr-xr-x 0 root root 512 Jan 1 1970 .. |
| 1594 | * drwxr-xr-x 0 root root 512 Apr 5 07:45 bin |
| 1595 | * >> 4 >> |
| 1596 | * -rwxr-xr-x 1 root root [\d]+ Jan 1 1970 init |
| 1597 | * >> M A N Y M O R E E N T R I E S >> |
| 1598 | * drwxr-xr-x 0 root root 512 Sep 22 2017 var |
| 1599 | * }</pre> |
| 1600 | * <p>Fails with a generated failure message describing the difference. |
| 1601 | */ |
| 1602 | public static void assertLinesMatch(List<String> expectedLines, List<String> actualLines) { |
| 1603 | AssertLinesMatch.assertLinesMatch(expectedLines, actualLines); |
| 1604 | } |
| 1605 | |
| 1606 | /** |
| 1607 | * <em>Assert</em> that {@code expected} list of {@linkplain String}s matches {@code actual} |
| 1608 | * list. |
| 1609 | * |
| 1610 | * <p>Find a detailed description of the matching algorithm in {@link #assertLinesMatch(List, List)}. |
| 1611 | * |
| 1612 | * <p>Fails with the supplied failure {@code message} and the generated message. |
| 1613 | * |
| 1614 | * @see #assertLinesMatch(List, List) |
| 1615 | */ |
| 1616 | public static void assertLinesMatch(List<String> expectedLines, List<String> actualLines, String message) { |
| 1617 | AssertLinesMatch.assertLinesMatch(expectedLines, actualLines, message); |
| 1618 | } |
| 1619 | |
| 1620 | /** |
| 1621 | * <em>Assert</em> that {@code expected} list of {@linkplain String}s matches {@code actual} |
| 1622 | * list. |
| 1623 | * |
| 1624 | * <p>Find a detailed description of the matching algorithm in {@link #assertLinesMatch(List, List)}. |
| 1625 | * |
| 1626 | * <p>If necessary, a custom failure message will be retrieved lazily from the supplied |
| 1627 | * {@code messageSupplier}. Fails with the custom failure message prepended to |
| 1628 | * a generated failure message describing the difference. |
| 1629 | * |
| 1630 | * @see #assertLinesMatch(List, List) |
| 1631 | */ |
| 1632 | public static void assertLinesMatch(List<String> expectedLines, List<String> actualLines, |
| 1633 | Supplier<String> messageSupplier) { |
| 1634 | AssertLinesMatch.assertLinesMatch(expectedLines, actualLines, messageSupplier); |
| 1635 | } |
| 1636 | |
| 1637 | /** |
| 1638 | * <em>Assert</em> that {@code expected} stream of {@linkplain String}s matches {@code actual} |
| 1639 | * stream. |
| 1640 | * |
| 1641 | * <p>Find a detailed description of the matching algorithm in {@link #assertLinesMatch(List, List)}. |
| 1642 | * |
| 1643 | * <p>Note: An implementation of this method may consume all lines of both streams eagerly and |
| 1644 | * delegate the evaluation to {@link #assertLinesMatch(List, List)}. |
| 1645 | * |
| 1646 | * @since 5.7 |
| 1647 | * @see #assertLinesMatch(List, List) |
| 1648 | */ |
| 1649 | public static void assertLinesMatch(Stream<String> expectedLines, Stream<String> actualLines) { |
| 1650 | AssertLinesMatch.assertLinesMatch(expectedLines, actualLines); |
| 1651 | } |
| 1652 | |
| 1653 | /** |
| 1654 | * <em>Assert</em> that {@code expected} stream of {@linkplain String}s matches {@code actual} |
| 1655 | * stream. |
| 1656 | * |
| 1657 | * <p>Find a detailed description of the matching algorithm in {@link #assertLinesMatch(List, List)}. |
| 1658 | * |
| 1659 | * <p>Fails with the supplied failure {@code message} and the generated message. |
| 1660 | * |
| 1661 | * <p>Note: An implementation of this method may consume all lines of both streams eagerly and |
| 1662 | * delegate the evaluation to {@link #assertLinesMatch(List, List)}. |
| 1663 | * |
| 1664 | * @since 5.7 |
| 1665 | * @see #assertLinesMatch(List, List) |
| 1666 | */ |
| 1667 | public static void assertLinesMatch(Stream<String> expectedLines, Stream<String> actualLines, String message) { |
| 1668 | AssertLinesMatch.assertLinesMatch(expectedLines, actualLines, message); |
| 1669 | } |
| 1670 | |
| 1671 | /** |
| 1672 | * <em>Assert</em> that {@code expected} stream of {@linkplain String}s matches {@code actual} |
| 1673 | * stream. |
| 1674 | * |
| 1675 | * <p>Find a detailed description of the matching algorithm in {@link #assertLinesMatch(List, List)}. |
| 1676 | * |
| 1677 | * <p>If necessary, a custom failure message will be retrieved lazily from the supplied |
| 1678 | * {@code messageSupplier}. Fails with the custom failure message prepended to |
| 1679 | * a generated failure message describing the difference. |
| 1680 | * |
| 1681 | * <p>Note: An implementation of this method may consume all lines of both streams eagerly and |
| 1682 | * delegate the evaluation to {@link #assertLinesMatch(List, List)}. |
| 1683 | * |
| 1684 | * @since 5.7 |
| 1685 | * @see #assertLinesMatch(List, List) |
| 1686 | */ |
| 1687 | public static void assertLinesMatch(Stream<String> expectedLines, Stream<String> actualLines, |
| 1688 | Supplier<String> messageSupplier) { |
| 1689 | AssertLinesMatch.assertLinesMatch(expectedLines, actualLines, messageSupplier); |
| 1690 | } |
| 1691 | |
| 1692 | // --- assertNotEquals ----------------------------------------------------- |
| 1693 | |
| 1694 | /** |
| 1695 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1696 | * |
| 1697 | * @since 5.4 |
| 1698 | */ |
| 1699 | @API(status = STABLE, since = "5.4") |
| 1700 | public static void assertNotEquals(byte unexpected, byte actual) { |
| 1701 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 1702 | } |
| 1703 | |
| 1704 | /** |
| 1705 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1706 | * |
| 1707 | * @since 5.4 |
| 1708 | */ |
| 1709 | @API(status = STABLE, since = "5.4") |
| 1710 | public static void assertNotEquals(byte unexpected, Byte actual) { |
| 1711 | AssertNotEquals.assertNotEquals((Byte) unexpected, actual); |
| 1712 | } |
| 1713 | |
| 1714 | /** |
| 1715 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1716 | * |
| 1717 | * @since 5.4 |
| 1718 | */ |
| 1719 | @API(status = STABLE, since = "5.4") |
| 1720 | public static void assertNotEquals(Byte unexpected, byte actual) { |
| 1721 | AssertNotEquals.assertNotEquals(unexpected, (Byte) actual); |
| 1722 | } |
| 1723 | |
| 1724 | /** |
| 1725 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1726 | * |
| 1727 | * @since 5.4 |
| 1728 | */ |
| 1729 | @API(status = STABLE, since = "5.4") |
| 1730 | public static void assertNotEquals(Byte unexpected, Byte actual) { |
| 1731 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 1732 | } |
| 1733 | |
| 1734 | /** |
| 1735 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1736 | * |
| 1737 | * <p>Fails with the supplied failure {@code message}. |
| 1738 | * |
| 1739 | * @since 5.4 |
| 1740 | */ |
| 1741 | @API(status = STABLE, since = "5.4") |
| 1742 | public static void assertNotEquals(byte unexpected, byte actual, String message) { |
| 1743 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 1744 | } |
| 1745 | |
| 1746 | /** |
| 1747 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1748 | * |
| 1749 | * <p>Fails with the supplied failure {@code message}. |
| 1750 | * |
| 1751 | * @since 5.4 |
| 1752 | */ |
| 1753 | @API(status = STABLE, since = "5.4") |
| 1754 | public static void assertNotEquals(byte unexpected, Byte actual, String message) { |
| 1755 | AssertNotEquals.assertNotEquals((Byte) unexpected, actual, message); |
| 1756 | } |
| 1757 | |
| 1758 | /** |
| 1759 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1760 | * |
| 1761 | * <p>Fails with the supplied failure {@code message}. |
| 1762 | * |
| 1763 | * @since 5.4 |
| 1764 | */ |
| 1765 | @API(status = STABLE, since = "5.4") |
| 1766 | public static void assertNotEquals(Byte unexpected, byte actual, String message) { |
| 1767 | AssertNotEquals.assertNotEquals(unexpected, (Byte) actual, message); |
| 1768 | } |
| 1769 | |
| 1770 | /** |
| 1771 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1772 | * |
| 1773 | * <p>Fails with the supplied failure {@code message}. |
| 1774 | * |
| 1775 | * @since 5.4 |
| 1776 | */ |
| 1777 | @API(status = STABLE, since = "5.4") |
| 1778 | public static void assertNotEquals(Byte unexpected, Byte actual, String message) { |
| 1779 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 1780 | } |
| 1781 | |
| 1782 | /** |
| 1783 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1784 | * |
| 1785 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 1786 | * supplied {@code messageSupplier}. |
| 1787 | * |
| 1788 | * @since 5.4 |
| 1789 | */ |
| 1790 | @API(status = STABLE, since = "5.4") |
| 1791 | public static void assertNotEquals(byte unexpected, byte actual, Supplier<String> messageSupplier) { |
| 1792 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 1793 | } |
| 1794 | |
| 1795 | /** |
| 1796 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1797 | * |
| 1798 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 1799 | * supplied {@code messageSupplier}. |
| 1800 | * |
| 1801 | * @since 5.4 |
| 1802 | */ |
| 1803 | @API(status = STABLE, since = "5.4") |
| 1804 | public static void assertNotEquals(byte unexpected, Byte actual, Supplier<String> messageSupplier) { |
| 1805 | AssertNotEquals.assertNotEquals((Byte) unexpected, actual, messageSupplier); |
| 1806 | } |
| 1807 | |
| 1808 | /** |
| 1809 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1810 | * |
| 1811 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 1812 | * supplied {@code messageSupplier}. |
| 1813 | * |
| 1814 | * @since 5.4 |
| 1815 | */ |
| 1816 | @API(status = STABLE, since = "5.4") |
| 1817 | public static void assertNotEquals(Byte unexpected, byte actual, Supplier<String> messageSupplier) { |
| 1818 | AssertNotEquals.assertNotEquals(unexpected, (Byte) actual, messageSupplier); |
| 1819 | } |
| 1820 | |
| 1821 | /** |
| 1822 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1823 | * |
| 1824 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 1825 | * supplied {@code messageSupplier}. |
| 1826 | * |
| 1827 | * @since 5.4 |
| 1828 | */ |
| 1829 | @API(status = STABLE, since = "5.4") |
| 1830 | public static void assertNotEquals(Byte unexpected, Byte actual, Supplier<String> messageSupplier) { |
| 1831 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 1832 | } |
| 1833 | |
| 1834 | /** |
| 1835 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1836 | * |
| 1837 | * @since 5.4 |
| 1838 | */ |
| 1839 | @API(status = STABLE, since = "5.4") |
| 1840 | public static void assertNotEquals(short unexpected, short actual) { |
| 1841 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 1842 | } |
| 1843 | |
| 1844 | /** |
| 1845 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1846 | * |
| 1847 | * @since 5.4 |
| 1848 | */ |
| 1849 | @API(status = STABLE, since = "5.4") |
| 1850 | public static void assertNotEquals(short unexpected, Short actual) { |
| 1851 | AssertNotEquals.assertNotEquals((Short) unexpected, actual); |
| 1852 | } |
| 1853 | |
| 1854 | /** |
| 1855 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1856 | * |
| 1857 | * @since 5.4 |
| 1858 | */ |
| 1859 | @API(status = STABLE, since = "5.4") |
| 1860 | public static void assertNotEquals(Short unexpected, short actual) { |
| 1861 | AssertNotEquals.assertNotEquals(unexpected, (Short) actual); |
| 1862 | } |
| 1863 | |
| 1864 | /** |
| 1865 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1866 | * |
| 1867 | * @since 5.4 |
| 1868 | */ |
| 1869 | @API(status = STABLE, since = "5.4") |
| 1870 | public static void assertNotEquals(Short unexpected, Short actual) { |
| 1871 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 1872 | } |
| 1873 | |
| 1874 | /** |
| 1875 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1876 | * |
| 1877 | * <p>Fails with the supplied failure {@code message}. |
| 1878 | * |
| 1879 | * @since 5.4 |
| 1880 | */ |
| 1881 | @API(status = STABLE, since = "5.4") |
| 1882 | public static void assertNotEquals(short unexpected, short actual, String message) { |
| 1883 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 1884 | } |
| 1885 | |
| 1886 | /** |
| 1887 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1888 | * |
| 1889 | * <p>Fails with the supplied failure {@code message}. |
| 1890 | * |
| 1891 | * @since 5.4 |
| 1892 | */ |
| 1893 | @API(status = STABLE, since = "5.4") |
| 1894 | public static void assertNotEquals(short unexpected, Short actual, String message) { |
| 1895 | AssertNotEquals.assertNotEquals((Short) unexpected, actual, message); |
| 1896 | } |
| 1897 | |
| 1898 | /** |
| 1899 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1900 | * |
| 1901 | * <p>Fails with the supplied failure {@code message}. |
| 1902 | * |
| 1903 | * @since 5.4 |
| 1904 | */ |
| 1905 | @API(status = STABLE, since = "5.4") |
| 1906 | public static void assertNotEquals(Short unexpected, short actual, String message) { |
| 1907 | AssertNotEquals.assertNotEquals(unexpected, (Short) actual, message); |
| 1908 | } |
| 1909 | |
| 1910 | /** |
| 1911 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1912 | * |
| 1913 | * <p>Fails with the supplied failure {@code message}. |
| 1914 | * |
| 1915 | * @since 5.4 |
| 1916 | */ |
| 1917 | @API(status = STABLE, since = "5.4") |
| 1918 | public static void assertNotEquals(Short unexpected, Short actual, String message) { |
| 1919 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 1920 | } |
| 1921 | |
| 1922 | /** |
| 1923 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1924 | * |
| 1925 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 1926 | * supplied {@code messageSupplier}. |
| 1927 | * |
| 1928 | * @since 5.4 |
| 1929 | */ |
| 1930 | @API(status = STABLE, since = "5.4") |
| 1931 | public static void assertNotEquals(short unexpected, short actual, Supplier<String> messageSupplier) { |
| 1932 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 1933 | } |
| 1934 | |
| 1935 | /** |
| 1936 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1937 | * |
| 1938 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 1939 | * supplied {@code messageSupplier}. |
| 1940 | * |
| 1941 | * @since 5.4 |
| 1942 | */ |
| 1943 | @API(status = STABLE, since = "5.4") |
| 1944 | public static void assertNotEquals(short unexpected, Short actual, Supplier<String> messageSupplier) { |
| 1945 | AssertNotEquals.assertNotEquals((Short) unexpected, actual, messageSupplier); |
| 1946 | } |
| 1947 | |
| 1948 | /** |
| 1949 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1950 | * |
| 1951 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 1952 | * supplied {@code messageSupplier}. |
| 1953 | * |
| 1954 | * @since 5.4 |
| 1955 | */ |
| 1956 | @API(status = STABLE, since = "5.4") |
| 1957 | public static void assertNotEquals(Short unexpected, short actual, Supplier<String> messageSupplier) { |
| 1958 | AssertNotEquals.assertNotEquals(unexpected, (Short) actual, messageSupplier); |
| 1959 | } |
| 1960 | |
| 1961 | /** |
| 1962 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1963 | * |
| 1964 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 1965 | * supplied {@code messageSupplier}. |
| 1966 | * |
| 1967 | * @since 5.4 |
| 1968 | */ |
| 1969 | @API(status = STABLE, since = "5.4") |
| 1970 | public static void assertNotEquals(Short unexpected, Short actual, Supplier<String> messageSupplier) { |
| 1971 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 1972 | } |
| 1973 | |
| 1974 | /** |
| 1975 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1976 | * |
| 1977 | * @since 5.4 |
| 1978 | */ |
| 1979 | @API(status = STABLE, since = "5.4") |
| 1980 | public static void assertNotEquals(int unexpected, int actual) { |
| 1981 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 1982 | } |
| 1983 | |
| 1984 | /** |
| 1985 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1986 | * |
| 1987 | * @since 5.4 |
| 1988 | */ |
| 1989 | @API(status = STABLE, since = "5.4") |
| 1990 | public static void assertNotEquals(int unexpected, Integer actual) { |
| 1991 | AssertNotEquals.assertNotEquals((Integer) unexpected, actual); |
| 1992 | } |
| 1993 | |
| 1994 | /** |
| 1995 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 1996 | * |
| 1997 | * @since 5.4 |
| 1998 | */ |
| 1999 | @API(status = STABLE, since = "5.4") |
| 2000 | public static void assertNotEquals(Integer unexpected, int actual) { |
| 2001 | AssertNotEquals.assertNotEquals(unexpected, (Integer) actual); |
| 2002 | } |
| 2003 | |
| 2004 | /** |
| 2005 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2006 | * |
| 2007 | * @since 5.4 |
| 2008 | */ |
| 2009 | @API(status = STABLE, since = "5.4") |
| 2010 | public static void assertNotEquals(Integer unexpected, Integer actual) { |
| 2011 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2012 | } |
| 2013 | |
| 2014 | /** |
| 2015 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2016 | * |
| 2017 | * <p>Fails with the supplied failure {@code message}. |
| 2018 | * |
| 2019 | * @since 5.4 |
| 2020 | */ |
| 2021 | @API(status = STABLE, since = "5.4") |
| 2022 | public static void assertNotEquals(int unexpected, int actual, String message) { |
| 2023 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2024 | } |
| 2025 | |
| 2026 | /** |
| 2027 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2028 | * |
| 2029 | * <p>Fails with the supplied failure {@code message}. |
| 2030 | * |
| 2031 | * @since 5.4 |
| 2032 | */ |
| 2033 | @API(status = STABLE, since = "5.4") |
| 2034 | public static void assertNotEquals(int unexpected, Integer actual, String message) { |
| 2035 | AssertNotEquals.assertNotEquals((Integer) unexpected, actual, message); |
| 2036 | } |
| 2037 | |
| 2038 | /** |
| 2039 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2040 | * |
| 2041 | * <p>Fails with the supplied failure {@code message}. |
| 2042 | * |
| 2043 | * @since 5.4 |
| 2044 | */ |
| 2045 | @API(status = STABLE, since = "5.4") |
| 2046 | public static void assertNotEquals(Integer unexpected, int actual, String message) { |
| 2047 | AssertNotEquals.assertNotEquals(unexpected, (Integer) actual, message); |
| 2048 | } |
| 2049 | |
| 2050 | /** |
| 2051 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2052 | * |
| 2053 | * <p>Fails with the supplied failure {@code message}. |
| 2054 | * |
| 2055 | * @since 5.4 |
| 2056 | */ |
| 2057 | @API(status = STABLE, since = "5.4") |
| 2058 | public static void assertNotEquals(Integer unexpected, Integer actual, String message) { |
| 2059 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2060 | } |
| 2061 | |
| 2062 | /** |
| 2063 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2064 | * |
| 2065 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2066 | * supplied {@code messageSupplier}. |
| 2067 | * |
| 2068 | * @since 5.4 |
| 2069 | */ |
| 2070 | @API(status = STABLE, since = "5.4") |
| 2071 | public static void assertNotEquals(int unexpected, int actual, Supplier<String> messageSupplier) { |
| 2072 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2073 | } |
| 2074 | |
| 2075 | /** |
| 2076 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2077 | * |
| 2078 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2079 | * supplied {@code messageSupplier}. |
| 2080 | * |
| 2081 | * @since 5.4 |
| 2082 | */ |
| 2083 | @API(status = STABLE, since = "5.4") |
| 2084 | public static void assertNotEquals(int unexpected, Integer actual, Supplier<String> messageSupplier) { |
| 2085 | AssertNotEquals.assertNotEquals((Integer) unexpected, actual, messageSupplier); |
| 2086 | } |
| 2087 | |
| 2088 | /** |
| 2089 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2090 | * |
| 2091 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2092 | * supplied {@code messageSupplier}. |
| 2093 | * |
| 2094 | * @since 5.4 |
| 2095 | */ |
| 2096 | @API(status = STABLE, since = "5.4") |
| 2097 | public static void assertNotEquals(Integer unexpected, int actual, Supplier<String> messageSupplier) { |
| 2098 | AssertNotEquals.assertNotEquals(unexpected, (Integer) actual, messageSupplier); |
| 2099 | } |
| 2100 | |
| 2101 | /** |
| 2102 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2103 | * |
| 2104 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2105 | * supplied {@code messageSupplier}. |
| 2106 | * |
| 2107 | * @since 5.4 |
| 2108 | */ |
| 2109 | @API(status = STABLE, since = "5.4") |
| 2110 | public static void assertNotEquals(Integer unexpected, Integer actual, Supplier<String> messageSupplier) { |
| 2111 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2112 | } |
| 2113 | |
| 2114 | /** |
| 2115 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2116 | * |
| 2117 | * @since 5.4 |
| 2118 | */ |
| 2119 | @API(status = STABLE, since = "5.4") |
| 2120 | public static void assertNotEquals(long unexpected, long actual) { |
| 2121 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2122 | } |
| 2123 | |
| 2124 | /** |
| 2125 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2126 | * |
| 2127 | * @since 5.4 |
| 2128 | */ |
| 2129 | @API(status = STABLE, since = "5.4") |
| 2130 | public static void assertNotEquals(long unexpected, Long actual) { |
| 2131 | AssertNotEquals.assertNotEquals((Long) unexpected, actual); |
| 2132 | } |
| 2133 | |
| 2134 | /** |
| 2135 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2136 | * |
| 2137 | * @since 5.4 |
| 2138 | */ |
| 2139 | @API(status = STABLE, since = "5.4") |
| 2140 | public static void assertNotEquals(Long unexpected, long actual) { |
| 2141 | AssertNotEquals.assertNotEquals(unexpected, (Long) actual); |
| 2142 | } |
| 2143 | |
| 2144 | /** |
| 2145 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2146 | * |
| 2147 | * @since 5.4 |
| 2148 | */ |
| 2149 | @API(status = STABLE, since = "5.4") |
| 2150 | public static void assertNotEquals(Long unexpected, Long actual) { |
| 2151 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2152 | } |
| 2153 | |
| 2154 | /** |
| 2155 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2156 | * |
| 2157 | * <p>Fails with the supplied failure {@code message}. |
| 2158 | * |
| 2159 | * @since 5.4 |
| 2160 | */ |
| 2161 | @API(status = STABLE, since = "5.4") |
| 2162 | public static void assertNotEquals(long unexpected, long actual, String message) { |
| 2163 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2164 | } |
| 2165 | |
| 2166 | /** |
| 2167 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2168 | * |
| 2169 | * <p>Fails with the supplied failure {@code message}. |
| 2170 | * |
| 2171 | * @since 5.4 |
| 2172 | */ |
| 2173 | @API(status = STABLE, since = "5.4") |
| 2174 | public static void assertNotEquals(long unexpected, Long actual, String message) { |
| 2175 | AssertNotEquals.assertNotEquals((Long) unexpected, actual, message); |
| 2176 | } |
| 2177 | |
| 2178 | /** |
| 2179 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2180 | * |
| 2181 | * <p>Fails with the supplied failure {@code message}. |
| 2182 | * |
| 2183 | * @since 5.4 |
| 2184 | */ |
| 2185 | @API(status = STABLE, since = "5.4") |
| 2186 | public static void assertNotEquals(Long unexpected, long actual, String message) { |
| 2187 | AssertNotEquals.assertNotEquals(unexpected, (Long) actual, message); |
| 2188 | } |
| 2189 | |
| 2190 | /** |
| 2191 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2192 | * |
| 2193 | * <p>Fails with the supplied failure {@code message}. |
| 2194 | * |
| 2195 | * @since 5.4 |
| 2196 | */ |
| 2197 | @API(status = STABLE, since = "5.4") |
| 2198 | public static void assertNotEquals(Long unexpected, Long actual, String message) { |
| 2199 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2200 | } |
| 2201 | |
| 2202 | /** |
| 2203 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2204 | * |
| 2205 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2206 | * supplied {@code messageSupplier}. |
| 2207 | * |
| 2208 | * @since 5.4 |
| 2209 | */ |
| 2210 | @API(status = STABLE, since = "5.4") |
| 2211 | public static void assertNotEquals(long unexpected, long actual, Supplier<String> messageSupplier) { |
| 2212 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2213 | } |
| 2214 | |
| 2215 | /** |
| 2216 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2217 | * |
| 2218 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2219 | * supplied {@code messageSupplier}. |
| 2220 | * |
| 2221 | * @since 5.4 |
| 2222 | */ |
| 2223 | @API(status = STABLE, since = "5.4") |
| 2224 | public static void assertNotEquals(long unexpected, Long actual, Supplier<String> messageSupplier) { |
| 2225 | AssertNotEquals.assertNotEquals((Long) unexpected, actual, messageSupplier); |
| 2226 | } |
| 2227 | |
| 2228 | /** |
| 2229 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2230 | * |
| 2231 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2232 | * supplied {@code messageSupplier}. |
| 2233 | * |
| 2234 | * @since 5.4 |
| 2235 | */ |
| 2236 | @API(status = STABLE, since = "5.4") |
| 2237 | public static void assertNotEquals(Long unexpected, long actual, Supplier<String> messageSupplier) { |
| 2238 | AssertNotEquals.assertNotEquals(unexpected, (Long) actual, messageSupplier); |
| 2239 | } |
| 2240 | |
| 2241 | /** |
| 2242 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2243 | * |
| 2244 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2245 | * supplied {@code messageSupplier}. |
| 2246 | * |
| 2247 | * @since 5.4 |
| 2248 | */ |
| 2249 | @API(status = STABLE, since = "5.4") |
| 2250 | public static void assertNotEquals(Long unexpected, Long actual, Supplier<String> messageSupplier) { |
| 2251 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2252 | } |
| 2253 | |
| 2254 | /** |
| 2255 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2256 | * |
| 2257 | * <p>Inequality imposed by this method is consistent with |
| 2258 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2259 | * |
| 2260 | * @since 5.4 |
| 2261 | */ |
| 2262 | @API(status = STABLE, since = "5.4") |
| 2263 | public static void assertNotEquals(float unexpected, float actual) { |
| 2264 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2265 | } |
| 2266 | |
| 2267 | /** |
| 2268 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2269 | * |
| 2270 | * <p>Inequality imposed by this method is consistent with |
| 2271 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2272 | * |
| 2273 | * @since 5.4 |
| 2274 | */ |
| 2275 | @API(status = STABLE, since = "5.4") |
| 2276 | public static void assertNotEquals(float unexpected, Float actual) { |
| 2277 | AssertNotEquals.assertNotEquals((Float) unexpected, actual); |
| 2278 | } |
| 2279 | |
| 2280 | /** |
| 2281 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2282 | * |
| 2283 | * <p>Inequality imposed by this method is consistent with |
| 2284 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2285 | * |
| 2286 | * @since 5.4 |
| 2287 | */ |
| 2288 | @API(status = STABLE, since = "5.4") |
| 2289 | public static void assertNotEquals(Float unexpected, float actual) { |
| 2290 | AssertNotEquals.assertNotEquals(unexpected, (Float) actual); |
| 2291 | } |
| 2292 | |
| 2293 | /** |
| 2294 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2295 | * |
| 2296 | * <p>Inequality imposed by this method is consistent with |
| 2297 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2298 | * |
| 2299 | * @since 5.4 |
| 2300 | */ |
| 2301 | @API(status = STABLE, since = "5.4") |
| 2302 | public static void assertNotEquals(Float unexpected, Float actual) { |
| 2303 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2304 | } |
| 2305 | |
| 2306 | /** |
| 2307 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2308 | * |
| 2309 | * <p>Inequality imposed by this method is consistent with |
| 2310 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2311 | * |
| 2312 | * <p>Fails with the supplied failure {@code message}. |
| 2313 | * |
| 2314 | * @since 5.4 |
| 2315 | */ |
| 2316 | @API(status = STABLE, since = "5.4") |
| 2317 | public static void assertNotEquals(float unexpected, float actual, String message) { |
| 2318 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2319 | } |
| 2320 | |
| 2321 | /** |
| 2322 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2323 | * |
| 2324 | * <p>Inequality imposed by this method is consistent with |
| 2325 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2326 | * |
| 2327 | * <p>Fails with the supplied failure {@code message}. |
| 2328 | * |
| 2329 | * @since 5.4 |
| 2330 | */ |
| 2331 | @API(status = STABLE, since = "5.4") |
| 2332 | public static void assertNotEquals(float unexpected, Float actual, String message) { |
| 2333 | AssertNotEquals.assertNotEquals((Float) unexpected, actual, message); |
| 2334 | } |
| 2335 | |
| 2336 | /** |
| 2337 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2338 | * |
| 2339 | * <p>Inequality imposed by this method is consistent with |
| 2340 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2341 | * |
| 2342 | * <p>Fails with the supplied failure {@code message}. |
| 2343 | * |
| 2344 | * @since 5.4 |
| 2345 | */ |
| 2346 | @API(status = STABLE, since = "5.4") |
| 2347 | public static void assertNotEquals(Float unexpected, float actual, String message) { |
| 2348 | AssertNotEquals.assertNotEquals(unexpected, (Float) actual, message); |
| 2349 | } |
| 2350 | |
| 2351 | /** |
| 2352 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2353 | * |
| 2354 | * <p>Inequality imposed by this method is consistent with |
| 2355 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2356 | * |
| 2357 | * <p>Fails with the supplied failure {@code message}. |
| 2358 | * |
| 2359 | * @since 5.4 |
| 2360 | */ |
| 2361 | @API(status = STABLE, since = "5.4") |
| 2362 | public static void assertNotEquals(Float unexpected, Float actual, String message) { |
| 2363 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2364 | } |
| 2365 | |
| 2366 | /** |
| 2367 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2368 | * |
| 2369 | * <p>Inequality imposed by this method is consistent with |
| 2370 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2371 | * |
| 2372 | * @since 5.4 |
| 2373 | */ |
| 2374 | @API(status = STABLE, since = "5.4") |
| 2375 | public static void assertNotEquals(float unexpected, float actual, Supplier<String> messageSupplier) { |
| 2376 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2377 | } |
| 2378 | |
| 2379 | /** |
| 2380 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2381 | * |
| 2382 | * <p>Inequality imposed by this method is consistent with |
| 2383 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2384 | * |
| 2385 | * @since 5.4 |
| 2386 | */ |
| 2387 | @API(status = STABLE, since = "5.4") |
| 2388 | public static void assertNotEquals(float unexpected, Float actual, Supplier<String> messageSupplier) { |
| 2389 | AssertNotEquals.assertNotEquals((Float) unexpected, actual, messageSupplier); |
| 2390 | } |
| 2391 | |
| 2392 | /** |
| 2393 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2394 | * |
| 2395 | * <p>Inequality imposed by this method is consistent with |
| 2396 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2397 | * |
| 2398 | * @since 5.4 |
| 2399 | */ |
| 2400 | @API(status = STABLE, since = "5.4") |
| 2401 | public static void assertNotEquals(Float unexpected, float actual, Supplier<String> messageSupplier) { |
| 2402 | AssertNotEquals.assertNotEquals(unexpected, (Float) actual, messageSupplier); |
| 2403 | } |
| 2404 | |
| 2405 | /** |
| 2406 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2407 | * |
| 2408 | * <p>Inequality imposed by this method is consistent with |
| 2409 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2410 | * |
| 2411 | * @since 5.4 |
| 2412 | */ |
| 2413 | @API(status = STABLE, since = "5.4") |
| 2414 | public static void assertNotEquals(Float unexpected, Float actual, Supplier<String> messageSupplier) { |
| 2415 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2416 | } |
| 2417 | |
| 2418 | /** |
| 2419 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal |
| 2420 | * within the given {@code delta}. |
| 2421 | * |
| 2422 | * <p>Inequality imposed by this method is consistent with |
| 2423 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2424 | * |
| 2425 | * @since 5.4 |
| 2426 | */ |
| 2427 | @API(status = STABLE, since = "5.4") |
| 2428 | public static void assertNotEquals(float unexpected, float actual, float delta) { |
| 2429 | AssertNotEquals.assertNotEquals(unexpected, actual, delta); |
| 2430 | } |
| 2431 | |
| 2432 | /** |
| 2433 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal |
| 2434 | * within the given {@code delta}. |
| 2435 | * |
| 2436 | * <p>Inequality imposed by this method is consistent with |
| 2437 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2438 | * |
| 2439 | * <p>Fails with the supplied failure {@code message}. |
| 2440 | * |
| 2441 | * @since 5.4 |
| 2442 | */ |
| 2443 | @API(status = STABLE, since = "5.4") |
| 2444 | public static void assertNotEquals(float unexpected, float actual, float delta, String message) { |
| 2445 | AssertNotEquals.assertNotEquals(unexpected, actual, delta, message); |
| 2446 | } |
| 2447 | |
| 2448 | /** |
| 2449 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal |
| 2450 | * within the given {@code delta}. |
| 2451 | * |
| 2452 | * <p>Inequality imposed by this method is consistent with |
| 2453 | * {@link Float#equals(Object)} and {@link Float#compare(float, float)}. |
| 2454 | * |
| 2455 | * @since 5.4 |
| 2456 | */ |
| 2457 | @API(status = STABLE, since = "5.4") |
| 2458 | public static void assertNotEquals(float unexpected, float actual, float delta, Supplier<String> messageSupplier) { |
| 2459 | AssertNotEquals.assertNotEquals(unexpected, actual, delta, messageSupplier); |
| 2460 | } |
| 2461 | |
| 2462 | /** |
| 2463 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2464 | * |
| 2465 | * <p>Inequality imposed by this method is consistent with |
| 2466 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2467 | * |
| 2468 | * @since 5.4 |
| 2469 | */ |
| 2470 | @API(status = STABLE, since = "5.4") |
| 2471 | public static void assertNotEquals(double unexpected, double actual) { |
| 2472 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2473 | } |
| 2474 | |
| 2475 | /** |
| 2476 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2477 | * |
| 2478 | * <p>Inequality imposed by this method is consistent with |
| 2479 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2480 | * |
| 2481 | * @since 5.4 |
| 2482 | */ |
| 2483 | @API(status = STABLE, since = "5.4") |
| 2484 | public static void assertNotEquals(double unexpected, Double actual) { |
| 2485 | AssertNotEquals.assertNotEquals((Double) unexpected, actual); |
| 2486 | } |
| 2487 | |
| 2488 | /** |
| 2489 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2490 | * |
| 2491 | * <p>Inequality imposed by this method is consistent with |
| 2492 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2493 | * |
| 2494 | * @since 5.4 |
| 2495 | */ |
| 2496 | @API(status = STABLE, since = "5.4") |
| 2497 | public static void assertNotEquals(Double unexpected, double actual) { |
| 2498 | AssertNotEquals.assertNotEquals(unexpected, (Double) actual); |
| 2499 | } |
| 2500 | |
| 2501 | /** |
| 2502 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2503 | * |
| 2504 | * <p>Inequality imposed by this method is consistent with |
| 2505 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2506 | * |
| 2507 | * @since 5.4 |
| 2508 | */ |
| 2509 | @API(status = STABLE, since = "5.4") |
| 2510 | public static void assertNotEquals(Double unexpected, Double actual) { |
| 2511 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2512 | } |
| 2513 | |
| 2514 | /** |
| 2515 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2516 | * |
| 2517 | * <p>Inequality imposed by this method is consistent with |
| 2518 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2519 | * |
| 2520 | * <p>Fails with the supplied failure {@code message}. |
| 2521 | * |
| 2522 | * @since 5.4 |
| 2523 | */ |
| 2524 | @API(status = STABLE, since = "5.4") |
| 2525 | public static void assertNotEquals(double unexpected, double actual, String message) { |
| 2526 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2527 | } |
| 2528 | |
| 2529 | /** |
| 2530 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2531 | * |
| 2532 | * <p>Inequality imposed by this method is consistent with |
| 2533 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2534 | * |
| 2535 | * <p>Fails with the supplied failure {@code message}. |
| 2536 | * |
| 2537 | * @since 5.4 |
| 2538 | */ |
| 2539 | @API(status = STABLE, since = "5.4") |
| 2540 | public static void assertNotEquals(double unexpected, Double actual, String message) { |
| 2541 | AssertNotEquals.assertNotEquals((Double) unexpected, actual, message); |
| 2542 | } |
| 2543 | |
| 2544 | /** |
| 2545 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2546 | * |
| 2547 | * <p>Inequality imposed by this method is consistent with |
| 2548 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2549 | * |
| 2550 | * <p>Fails with the supplied failure {@code message}. |
| 2551 | * |
| 2552 | * @since 5.4 |
| 2553 | */ |
| 2554 | @API(status = STABLE, since = "5.4") |
| 2555 | public static void assertNotEquals(Double unexpected, double actual, String message) { |
| 2556 | AssertNotEquals.assertNotEquals(unexpected, (Double) actual, message); |
| 2557 | } |
| 2558 | |
| 2559 | /** |
| 2560 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2561 | * |
| 2562 | * <p>Inequality imposed by this method is consistent with |
| 2563 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2564 | * |
| 2565 | * <p>Fails with the supplied failure {@code message}. |
| 2566 | * |
| 2567 | * @since 5.4 |
| 2568 | */ |
| 2569 | @API(status = STABLE, since = "5.4") |
| 2570 | public static void assertNotEquals(Double unexpected, Double actual, String message) { |
| 2571 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2572 | } |
| 2573 | |
| 2574 | /** |
| 2575 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2576 | * |
| 2577 | * <p>Inequality imposed by this method is consistent with |
| 2578 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2579 | * |
| 2580 | * @since 5.4 |
| 2581 | */ |
| 2582 | @API(status = STABLE, since = "5.4") |
| 2583 | public static void assertNotEquals(double unexpected, double actual, Supplier<String> messageSupplier) { |
| 2584 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2585 | } |
| 2586 | |
| 2587 | /** |
| 2588 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2589 | * |
| 2590 | * <p>Inequality imposed by this method is consistent with |
| 2591 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2592 | * |
| 2593 | * @since 5.4 |
| 2594 | */ |
| 2595 | @API(status = STABLE, since = "5.4") |
| 2596 | public static void assertNotEquals(double unexpected, Double actual, Supplier<String> messageSupplier) { |
| 2597 | AssertNotEquals.assertNotEquals((Double) unexpected, actual, messageSupplier); |
| 2598 | } |
| 2599 | |
| 2600 | /** |
| 2601 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2602 | * |
| 2603 | * <p>Inequality imposed by this method is consistent with |
| 2604 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2605 | * |
| 2606 | * @since 5.4 |
| 2607 | */ |
| 2608 | @API(status = STABLE, since = "5.4") |
| 2609 | public static void assertNotEquals(Double unexpected, double actual, Supplier<String> messageSupplier) { |
| 2610 | AssertNotEquals.assertNotEquals(unexpected, (Double) actual, messageSupplier); |
| 2611 | } |
| 2612 | |
| 2613 | /** |
| 2614 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2615 | * |
| 2616 | * <p>Inequality imposed by this method is consistent with |
| 2617 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2618 | * |
| 2619 | * @since 5.4 |
| 2620 | */ |
| 2621 | @API(status = STABLE, since = "5.4") |
| 2622 | public static void assertNotEquals(Double unexpected, Double actual, Supplier<String> messageSupplier) { |
| 2623 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2624 | } |
| 2625 | |
| 2626 | /** |
| 2627 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal |
| 2628 | * within the given {@code delta}. |
| 2629 | * |
| 2630 | * <p>Inequality imposed by this method is consistent with |
| 2631 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2632 | * |
| 2633 | * @since 5.4 |
| 2634 | */ |
| 2635 | @API(status = STABLE, since = "5.4") |
| 2636 | public static void assertNotEquals(double unexpected, double actual, double delta) { |
| 2637 | AssertNotEquals.assertNotEquals(unexpected, actual, delta); |
| 2638 | } |
| 2639 | |
| 2640 | /** |
| 2641 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal |
| 2642 | * within the given {@code delta}. |
| 2643 | * |
| 2644 | * <p>Inequality imposed by this method is consistent with |
| 2645 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2646 | * |
| 2647 | * <p>Fails with the supplied failure {@code message}. |
| 2648 | * |
| 2649 | * @since 5.4 |
| 2650 | */ |
| 2651 | @API(status = STABLE, since = "5.4") |
| 2652 | public static void assertNotEquals(double unexpected, double actual, double delta, String message) { |
| 2653 | AssertNotEquals.assertNotEquals(unexpected, actual, delta, message); |
| 2654 | } |
| 2655 | |
| 2656 | /** |
| 2657 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal |
| 2658 | * within the given {@code delta}. |
| 2659 | * |
| 2660 | * <p>Inequality imposed by this method is consistent with |
| 2661 | * {@link Double#equals(Object)} and {@link Double#compare(double, double)}. |
| 2662 | * |
| 2663 | * @since 5.4 |
| 2664 | */ |
| 2665 | @API(status = STABLE, since = "5.4") |
| 2666 | public static void assertNotEquals(double unexpected, double actual, double delta, |
| 2667 | Supplier<String> messageSupplier) { |
| 2668 | AssertNotEquals.assertNotEquals(unexpected, actual, delta, messageSupplier); |
| 2669 | } |
| 2670 | |
| 2671 | /** |
| 2672 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2673 | * |
| 2674 | * @since 5.4 |
| 2675 | */ |
| 2676 | @API(status = STABLE, since = "5.4") |
| 2677 | public static void assertNotEquals(char unexpected, char actual) { |
| 2678 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2679 | } |
| 2680 | |
| 2681 | /** |
| 2682 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2683 | * |
| 2684 | * @since 5.4 |
| 2685 | */ |
| 2686 | @API(status = STABLE, since = "5.4") |
| 2687 | public static void assertNotEquals(char unexpected, Character actual) { |
| 2688 | AssertNotEquals.assertNotEquals((Character) unexpected, actual); |
| 2689 | } |
| 2690 | |
| 2691 | /** |
| 2692 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2693 | * |
| 2694 | * @since 5.4 |
| 2695 | */ |
| 2696 | @API(status = STABLE, since = "5.4") |
| 2697 | public static void assertNotEquals(Character unexpected, char actual) { |
| 2698 | AssertNotEquals.assertNotEquals(unexpected, (Character) actual); |
| 2699 | } |
| 2700 | |
| 2701 | /** |
| 2702 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2703 | * |
| 2704 | * @since 5.4 |
| 2705 | */ |
| 2706 | @API(status = STABLE, since = "5.4") |
| 2707 | public static void assertNotEquals(Character unexpected, Character actual) { |
| 2708 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2709 | } |
| 2710 | |
| 2711 | /** |
| 2712 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2713 | * |
| 2714 | * <p>Fails with the supplied failure {@code message}. |
| 2715 | * |
| 2716 | * @since 5.4 |
| 2717 | */ |
| 2718 | @API(status = STABLE, since = "5.4") |
| 2719 | public static void assertNotEquals(char unexpected, char actual, String message) { |
| 2720 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2721 | } |
| 2722 | |
| 2723 | /** |
| 2724 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2725 | * |
| 2726 | * <p>Fails with the supplied failure {@code message}. |
| 2727 | * |
| 2728 | * @since 5.4 |
| 2729 | */ |
| 2730 | @API(status = STABLE, since = "5.4") |
| 2731 | public static void assertNotEquals(char unexpected, Character actual, String message) { |
| 2732 | AssertNotEquals.assertNotEquals((Character) unexpected, actual, message); |
| 2733 | } |
| 2734 | |
| 2735 | /** |
| 2736 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2737 | * |
| 2738 | * <p>Fails with the supplied failure {@code message}. |
| 2739 | * |
| 2740 | * @since 5.4 |
| 2741 | */ |
| 2742 | @API(status = STABLE, since = "5.4") |
| 2743 | public static void assertNotEquals(Character unexpected, char actual, String message) { |
| 2744 | AssertNotEquals.assertNotEquals(unexpected, (Character) actual, message); |
| 2745 | } |
| 2746 | |
| 2747 | /** |
| 2748 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2749 | * |
| 2750 | * <p>Fails with the supplied failure {@code message}. |
| 2751 | * |
| 2752 | * @since 5.4 |
| 2753 | */ |
| 2754 | @API(status = STABLE, since = "5.4") |
| 2755 | public static void assertNotEquals(Character unexpected, Character actual, String message) { |
| 2756 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2757 | } |
| 2758 | |
| 2759 | /** |
| 2760 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2761 | * |
| 2762 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2763 | * supplied {@code messageSupplier}. |
| 2764 | * |
| 2765 | * @since 5.4 |
| 2766 | */ |
| 2767 | @API(status = STABLE, since = "5.4") |
| 2768 | public static void assertNotEquals(char unexpected, char actual, Supplier<String> messageSupplier) { |
| 2769 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2770 | } |
| 2771 | |
| 2772 | /** |
| 2773 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2774 | * |
| 2775 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2776 | * supplied {@code messageSupplier}. |
| 2777 | * |
| 2778 | * @since 5.4 |
| 2779 | */ |
| 2780 | @API(status = STABLE, since = "5.4") |
| 2781 | public static void assertNotEquals(char unexpected, Character actual, Supplier<String> messageSupplier) { |
| 2782 | AssertNotEquals.assertNotEquals((Character) unexpected, actual, messageSupplier); |
| 2783 | } |
| 2784 | |
| 2785 | /** |
| 2786 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2787 | * |
| 2788 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2789 | * supplied {@code messageSupplier}. |
| 2790 | * |
| 2791 | * @since 5.4 |
| 2792 | */ |
| 2793 | @API(status = STABLE, since = "5.4") |
| 2794 | public static void assertNotEquals(Character unexpected, char actual, Supplier<String> messageSupplier) { |
| 2795 | AssertNotEquals.assertNotEquals(unexpected, (Character) actual, messageSupplier); |
| 2796 | } |
| 2797 | |
| 2798 | /** |
| 2799 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2800 | * |
| 2801 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2802 | * supplied {@code messageSupplier}. |
| 2803 | * |
| 2804 | * @since 5.4 |
| 2805 | */ |
| 2806 | @API(status = STABLE, since = "5.4") |
| 2807 | public static void assertNotEquals(Character unexpected, Character actual, Supplier<String> messageSupplier) { |
| 2808 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2809 | } |
| 2810 | |
| 2811 | /** |
| 2812 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2813 | * |
| 2814 | * <p>Fails if both are {@code null}. |
| 2815 | * |
| 2816 | * @see Object#equals(Object) |
| 2817 | */ |
| 2818 | public static void assertNotEquals(Object unexpected, Object actual) { |
| 2819 | AssertNotEquals.assertNotEquals(unexpected, actual); |
| 2820 | } |
| 2821 | |
| 2822 | /** |
| 2823 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2824 | * |
| 2825 | * <p>Fails if both are {@code null}. |
| 2826 | * |
| 2827 | * <p>Fails with the supplied failure {@code message}. |
| 2828 | * |
| 2829 | * @see Object#equals(Object) |
| 2830 | */ |
| 2831 | public static void assertNotEquals(Object unexpected, Object actual, String message) { |
| 2832 | AssertNotEquals.assertNotEquals(unexpected, actual, message); |
| 2833 | } |
| 2834 | |
| 2835 | /** |
| 2836 | * <em>Assert</em> that {@code expected} and {@code actual} are not equal. |
| 2837 | * |
| 2838 | * <p>Fails if both are {@code null}. |
| 2839 | * |
| 2840 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 2841 | * supplied {@code messageSupplier}. |
| 2842 | * |
| 2843 | * @see Object#equals(Object) |
| 2844 | */ |
| 2845 | public static void assertNotEquals(Object unexpected, Object actual, Supplier<String> messageSupplier) { |
| 2846 | AssertNotEquals.assertNotEquals(unexpected, actual, messageSupplier); |
| 2847 | } |
| 2848 | |
| 2849 | // --- assertSame ---------------------------------------------------------- |
| 2850 | |
| 2851 | /** |
| 2852 | * <em>Assert</em> that the {@code expected} object and the {@code actual} object |
| 2853 | * are the same object. |
| 2854 | * <p>This method should only be used to assert <em>identity</em> between objects. |
| 2855 | * To assert <em>equality</em> between two objects or two primitive values, |
| 2856 | * use one of the {@code assertEquals(...)} methods instead — for example, |
| 2857 | * use {@code assertEquals(999, 999)} instead of {@code assertSame(999, 999)}. |
| 2858 | */ |
| 2859 | public static void assertSame(Object expected, Object actual) { |
| 2860 | AssertSame.assertSame(expected, actual); |
| 2861 | } |
| 2862 | |
| 2863 | /** |
| 2864 | * <em>Assert</em> that the {@code expected} object and the {@code actual} object |
| 2865 | * are the same object. |
| 2866 | * <p>This method should only be used to assert <em>identity</em> between objects. |
| 2867 | * To assert <em>equality</em> between two objects or two primitive values, |
| 2868 | * use one of the {@code assertEquals(...)} methods instead — for example, |
| 2869 | * use {@code assertEquals(999, 999)} instead of {@code assertSame(999, 999)}. |
| 2870 | * <p>Fails with the supplied failure {@code message}. |
| 2871 | */ |
| 2872 | public static void assertSame(Object expected, Object actual, String message) { |
| 2873 | AssertSame.assertSame(expected, actual, message); |
| 2874 | } |
| 2875 | |
| 2876 | /** |
| 2877 | * <em>Assert</em> that the {@code expected} object and the {@code actual} object |
| 2878 | * are the same object. |
| 2879 | * <p>This method should only be used to assert <em>identity</em> between objects. |
| 2880 | * To assert <em>equality</em> between two objects or two primitive values, |
| 2881 | * use one of the {@code assertEquals(...)} methods instead — for example, |
| 2882 | * use {@code assertEquals(999, 999)} instead of {@code assertSame(999, 999)}. |
| 2883 | * <p>If necessary, the failure message will be retrieved lazily from the supplied |
| 2884 | * {@code messageSupplier}. |
| 2885 | */ |
| 2886 | public static void assertSame(Object expected, Object actual, Supplier<String> messageSupplier) { |
| 2887 | AssertSame.assertSame(expected, actual, messageSupplier); |
| 2888 | } |
| 2889 | |
| 2890 | // --- assertNotSame ------------------------------------------------------- |
| 2891 | |
| 2892 | /** |
| 2893 | * <em>Assert</em> that the {@code unexpected} object and the {@code actual} |
| 2894 | * object are not the same object. |
| 2895 | * <p>This method should only be used to compare the <em>identity</em> of two |
| 2896 | * objects. To assert that two objects or two primitive values are not |
| 2897 | * <em>equal</em>, use one of the {@code assertNotEquals(...)} methods instead. |
| 2898 | */ |
| 2899 | public static void assertNotSame(Object unexpected, Object actual) { |
| 2900 | AssertNotSame.assertNotSame(unexpected, actual); |
| 2901 | } |
| 2902 | |
| 2903 | /** |
| 2904 | * <em>Assert</em> that the {@code unexpected} object and the {@code actual} |
| 2905 | * object are not the same object. |
| 2906 | * <p>This method should only be used to compare the <em>identity</em> of two |
| 2907 | * objects. To assert that two objects or two primitive values are not |
| 2908 | * <em>equal</em>, use one of the {@code assertNotEquals(...)} methods instead. |
| 2909 | * <p>Fails with the supplied failure {@code message}. |
| 2910 | */ |
| 2911 | public static void assertNotSame(Object unexpected, Object actual, String message) { |
| 2912 | AssertNotSame.assertNotSame(unexpected, actual, message); |
| 2913 | } |
| 2914 | |
| 2915 | /** |
| 2916 | * <em>Assert</em> that the {@code unexpected} object and the {@code actual} |
| 2917 | * object are not the same object. |
| 2918 | * <p>This method should only be used to compare the <em>identity</em> of two |
| 2919 | * objects. To assert that two objects or two primitive values are not |
| 2920 | * <em>equal</em>, use one of the {@code assertNotEquals(...)} methods instead. |
| 2921 | * <p>If necessary, the failure message will be retrieved lazily from the supplied |
| 2922 | * {@code messageSupplier}. |
| 2923 | */ |
| 2924 | public static void assertNotSame(Object unexpected, Object actual, Supplier<String> messageSupplier) { |
| 2925 | AssertNotSame.assertNotSame(unexpected, actual, messageSupplier); |
| 2926 | } |
| 2927 | |
| 2928 | // --- assertAll ----------------------------------------------------------- |
| 2929 | |
| 2930 | /** |
| 2931 | * <em>Assert</em> that <em>all</em> supplied {@code executables} do not throw |
| 2932 | * exceptions. |
| 2933 | * |
| 2934 | * <p>See Javadoc for {@link #assertAll(String, Stream)} for an explanation of this |
| 2935 | * method's exception handling semantics. |
| 2936 | * |
| 2937 | * @see #assertAll(String, Executable...) |
| 2938 | * @see #assertAll(Collection) |
| 2939 | * @see #assertAll(String, Collection) |
| 2940 | * @see #assertAll(Stream) |
| 2941 | * @see #assertAll(String, Stream) |
| 2942 | */ |
| 2943 | public static void assertAll(Executable... executables) throws MultipleFailuresError { |
| 2944 | AssertAll.assertAll(executables); |
| 2945 | } |
| 2946 | |
| 2947 | /** |
| 2948 | * <em>Assert</em> that <em>all</em> supplied {@code executables} do not throw |
| 2949 | * exceptions. |
| 2950 | * |
| 2951 | * <p>See Javadoc for {@link #assertAll(String, Stream)} for an explanation of this |
| 2952 | * method's exception handling semantics. |
| 2953 | * |
| 2954 | * @see #assertAll(Executable...) |
| 2955 | * @see #assertAll(Collection) |
| 2956 | * @see #assertAll(Stream) |
| 2957 | * @see #assertAll(String, Collection) |
| 2958 | * @see #assertAll(String, Stream) |
| 2959 | */ |
| 2960 | public static void assertAll(String heading, Executable... executables) throws MultipleFailuresError { |
| 2961 | AssertAll.assertAll(heading, executables); |
| 2962 | } |
| 2963 | |
| 2964 | /** |
| 2965 | * <em>Assert</em> that <em>all</em> supplied {@code executables} do not throw |
| 2966 | * exceptions. |
| 2967 | * |
| 2968 | * <p>See Javadoc for {@link #assertAll(String, Stream)} for an explanation of this |
| 2969 | * method's exception handling semantics. |
| 2970 | * |
| 2971 | * @see #assertAll(Executable...) |
| 2972 | * @see #assertAll(String, Executable...) |
| 2973 | * @see #assertAll(String, Collection) |
| 2974 | * @see #assertAll(Stream) |
| 2975 | * @see #assertAll(String, Stream) |
| 2976 | */ |
| 2977 | public static void assertAll(Collection<Executable> executables) throws MultipleFailuresError { |
| 2978 | AssertAll.assertAll(executables); |
| 2979 | } |
| 2980 | |
| 2981 | /** |
| 2982 | * <em>Assert</em> that <em>all</em> supplied {@code executables} do not throw |
| 2983 | * exceptions. |
| 2984 | * |
| 2985 | * <p>See Javadoc for {@link #assertAll(String, Stream)} for an explanation of this |
| 2986 | * method's exception handling semantics. |
| 2987 | * |
| 2988 | * @see #assertAll(Executable...) |
| 2989 | * @see #assertAll(String, Executable...) |
| 2990 | * @see #assertAll(Collection) |
| 2991 | * @see #assertAll(Stream) |
| 2992 | * @see #assertAll(String, Stream) |
| 2993 | */ |
| 2994 | public static void assertAll(String heading, Collection<Executable> executables) throws MultipleFailuresError { |
| 2995 | AssertAll.assertAll(heading, executables); |
| 2996 | } |
| 2997 | |
| 2998 | /** |
| 2999 | * <em>Assert</em> that <em>all</em> supplied {@code executables} do not throw |
| 3000 | * exceptions. |
| 3001 | * |
| 3002 | * <p>See Javadoc for {@link #assertAll(String, Stream)} for an explanation of this |
| 3003 | * method's exception handling semantics. |
| 3004 | * |
| 3005 | * @see #assertAll(Executable...) |
| 3006 | * @see #assertAll(String, Executable...) |
| 3007 | * @see #assertAll(Collection) |
| 3008 | * @see #assertAll(String, Collection) |
| 3009 | * @see #assertAll(String, Stream) |
| 3010 | */ |
| 3011 | public static void assertAll(Stream<Executable> executables) throws MultipleFailuresError { |
| 3012 | AssertAll.assertAll(executables); |
| 3013 | } |
| 3014 | |
| 3015 | /** |
| 3016 | * <em>Assert</em> that <em>all</em> supplied {@code executables} do not throw |
| 3017 | * exceptions. |
| 3018 | * |
| 3019 | * <p>If any supplied {@link Executable} throws an exception (i.e., a {@link Throwable} |
| 3020 | * or any subclass thereof), all remaining {@code executables} will still be executed, |
| 3021 | * and all exceptions will be aggregated and reported in a {@link MultipleFailuresError}. |
| 3022 | * In addition, all aggregated exceptions will be added as {@linkplain |
| 3023 | * Throwable#addSuppressed(Throwable) suppressed exceptions} to the |
| 3024 | * {@code MultipleFailuresError}. However, if an {@code executable} throws an |
| 3025 | * <em>unrecoverable</em> exception — for example, an {@link OutOfMemoryError} |
| 3026 | * — execution will halt immediately, and the unrecoverable exception will be |
| 3027 | * rethrown <em>as is</em> but <em>masked</em> as an unchecked exception. |
| 3028 | * |
| 3029 | * <p>The supplied {@code heading} will be included in the message string for the |
| 3030 | * {@code MultipleFailuresError}. |
| 3031 | * |
| 3032 | * @see #assertAll(Executable...) |
| 3033 | * @see #assertAll(String, Executable...) |
| 3034 | * @see #assertAll(Collection) |
| 3035 | * @see #assertAll(String, Collection) |
| 3036 | * @see #assertAll(Stream) |
| 3037 | */ |
| 3038 | public static void assertAll(String heading, Stream<Executable> executables) throws MultipleFailuresError { |
| 3039 | AssertAll.assertAll(heading, executables); |
| 3040 | } |
| 3041 | |
| 3042 | // --- assert exceptions --------------------------------------------------- |
| 3043 | |
| 3044 | // --- executable --- |
| 3045 | |
| 3046 | /** |
| 3047 | * <em>Assert</em> that execution of the supplied {@code executable} throws |
| 3048 | * an exception of exactly the {@code expectedType} and return the exception. |
| 3049 | * |
| 3050 | * <p>If no exception is thrown, or if an exception of a different type is |
| 3051 | * thrown, this method will fail. |
| 3052 | * |
| 3053 | * <p>If you do not want to perform additional checks on the exception instance, |
| 3054 | * ignore the return value. |
| 3055 | * |
| 3056 | * @since 5.8 |
| 3057 | */ |
| 3058 | @API(status = STABLE, since = "5.10") |
| 3059 | public static <T extends Throwable> T assertThrowsExactly(Class<T> expectedType, Executable executable) { |
| 3060 | return AssertThrowsExactly.assertThrowsExactly(expectedType, executable); |
| 3061 | } |
| 3062 | |
| 3063 | /** |
| 3064 | * <em>Assert</em> that execution of the supplied {@code executable} throws |
| 3065 | * an exception of exactly the {@code expectedType} and return the exception. |
| 3066 | * |
| 3067 | * <p>If no exception is thrown, or if an exception of a different type is |
| 3068 | * thrown, this method will fail. |
| 3069 | * |
| 3070 | * <p>If you do not want to perform additional checks on the exception instance, |
| 3071 | * ignore the return value. |
| 3072 | * |
| 3073 | * <p>Fails with the supplied failure {@code message}. |
| 3074 | * |
| 3075 | * @since 5.8 |
| 3076 | */ |
| 3077 | @API(status = STABLE, since = "5.10") |
| 3078 | public static <T extends Throwable> T assertThrowsExactly(Class<T> expectedType, Executable executable, |
| 3079 | String message) { |
| 3080 | return AssertThrowsExactly.assertThrowsExactly(expectedType, executable, message); |
| 3081 | } |
| 3082 | |
| 3083 | /** |
| 3084 | * <em>Assert</em> that execution of the supplied {@code executable} throws |
| 3085 | * an exception of exactly the {@code expectedType} and return the exception. |
| 3086 | * |
| 3087 | * <p>If no exception is thrown, or if an exception of a different type is |
| 3088 | * thrown, this method will fail. |
| 3089 | * |
| 3090 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3091 | * supplied {@code messageSupplier}. |
| 3092 | * |
| 3093 | * <p>If you do not want to perform additional checks on the exception instance, |
| 3094 | * ignore the return value. |
| 3095 | * |
| 3096 | * @since 5.8 |
| 3097 | */ |
| 3098 | @API(status = STABLE, since = "5.10") |
| 3099 | public static <T extends Throwable> T assertThrowsExactly(Class<T> expectedType, Executable executable, |
| 3100 | Supplier<String> messageSupplier) { |
| 3101 | return AssertThrowsExactly.assertThrowsExactly(expectedType, executable, messageSupplier); |
| 3102 | } |
| 3103 | |
| 3104 | /** |
| 3105 | * <em>Assert</em> that execution of the supplied {@code executable} throws |
| 3106 | * an exception of the {@code expectedType} and return the exception. |
| 3107 | * |
| 3108 | * <p>If no exception is thrown, or if an exception of a different type is |
| 3109 | * thrown, this method will fail. |
| 3110 | * |
| 3111 | * <p>If you do not want to perform additional checks on the exception instance, |
| 3112 | * ignore the return value. |
| 3113 | */ |
| 3114 | public static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable) { |
| 3115 | return AssertThrows.assertThrows(expectedType, executable); |
| 3116 | } |
| 3117 | |
| 3118 | /** |
| 3119 | * <em>Assert</em> that execution of the supplied {@code executable} throws |
| 3120 | * an exception of the {@code expectedType} and return the exception. |
| 3121 | * |
| 3122 | * <p>If no exception is thrown, or if an exception of a different type is |
| 3123 | * thrown, this method will fail. |
| 3124 | * |
| 3125 | * <p>If you do not want to perform additional checks on the exception instance, |
| 3126 | * ignore the return value. |
| 3127 | * |
| 3128 | * <p>Fails with the supplied failure {@code message}. |
| 3129 | */ |
| 3130 | public static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable, String message) { |
| 3131 | return AssertThrows.assertThrows(expectedType, executable, message); |
| 3132 | } |
| 3133 | |
| 3134 | /** |
| 3135 | * <em>Assert</em> that execution of the supplied {@code executable} throws |
| 3136 | * an exception of the {@code expectedType} and return the exception. |
| 3137 | * |
| 3138 | * <p>If no exception is thrown, or if an exception of a different type is |
| 3139 | * thrown, this method will fail. |
| 3140 | * |
| 3141 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3142 | * supplied {@code messageSupplier}. |
| 3143 | * |
| 3144 | * <p>If you do not want to perform additional checks on the exception instance, |
| 3145 | * ignore the return value. |
| 3146 | */ |
| 3147 | public static <T extends Throwable> T assertThrows(Class<T> expectedType, Executable executable, |
| 3148 | Supplier<String> messageSupplier) { |
| 3149 | return AssertThrows.assertThrows(expectedType, executable, messageSupplier); |
| 3150 | } |
| 3151 | |
| 3152 | // --- executable --- |
| 3153 | |
| 3154 | /** |
| 3155 | * <em>Assert</em> that execution of the supplied {@code executable} does |
| 3156 | * <em>not</em> throw any kind of {@linkplain Throwable exception}. |
| 3157 | * |
| 3158 | * <h4>Usage Note</h4> |
| 3159 | * <p>Although any exception thrown from a test method will cause the test |
| 3160 | * to <em>fail</em>, there are certain use cases where it can be beneficial |
| 3161 | * to explicitly assert that an exception is not thrown for a given code |
| 3162 | * block within a test method. |
| 3163 | * |
| 3164 | * @since 5.2 |
| 3165 | */ |
| 3166 | @API(status = STABLE, since = "5.2") |
| 3167 | public static void assertDoesNotThrow(Executable executable) { |
| 3168 | AssertDoesNotThrow.assertDoesNotThrow(executable); |
| 3169 | } |
| 3170 | |
| 3171 | /** |
| 3172 | * <em>Assert</em> that execution of the supplied {@code executable} does |
| 3173 | * <em>not</em> throw any kind of {@linkplain Throwable exception}. |
| 3174 | * |
| 3175 | * <h4>Usage Note</h4> |
| 3176 | * <p>Although any exception thrown from a test method will cause the test |
| 3177 | * to <em>fail</em>, there are certain use cases where it can be beneficial |
| 3178 | * to explicitly assert that an exception is not thrown for a given code |
| 3179 | * block within a test method. |
| 3180 | * |
| 3181 | * <p>Fails with the supplied failure {@code message}. |
| 3182 | * |
| 3183 | * @since 5.2 |
| 3184 | */ |
| 3185 | @API(status = STABLE, since = "5.2") |
| 3186 | public static void assertDoesNotThrow(Executable executable, String message) { |
| 3187 | AssertDoesNotThrow.assertDoesNotThrow(executable, message); |
| 3188 | } |
| 3189 | |
| 3190 | /** |
| 3191 | * <em>Assert</em> that execution of the supplied {@code executable} does |
| 3192 | * <em>not</em> throw any kind of {@linkplain Throwable exception}. |
| 3193 | * |
| 3194 | * <h4>Usage Note</h4> |
| 3195 | * <p>Although any exception thrown from a test method will cause the test |
| 3196 | * to <em>fail</em>, there are certain use cases where it can be beneficial |
| 3197 | * to explicitly assert that an exception is not thrown for a given code |
| 3198 | * block within a test method. |
| 3199 | * |
| 3200 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3201 | * supplied {@code messageSupplier}. |
| 3202 | * |
| 3203 | * @since 5.2 |
| 3204 | */ |
| 3205 | @API(status = STABLE, since = "5.2") |
| 3206 | public static void assertDoesNotThrow(Executable executable, Supplier<String> messageSupplier) { |
| 3207 | AssertDoesNotThrow.assertDoesNotThrow(executable, messageSupplier); |
| 3208 | } |
| 3209 | |
| 3210 | // --- supplier --- |
| 3211 | |
| 3212 | /** |
| 3213 | * <em>Assert</em> that execution of the supplied {@code supplier} does |
| 3214 | * <em>not</em> throw any kind of {@linkplain Throwable exception}. |
| 3215 | * |
| 3216 | * <p>If the assertion passes, the {@code supplier}'s result will be returned. |
| 3217 | * |
| 3218 | * <h4>Usage Note</h4> |
| 3219 | * <p>Although any exception thrown from a test method will cause the test |
| 3220 | * to <em>fail</em>, there are certain use cases where it can be beneficial |
| 3221 | * to explicitly assert that an exception is not thrown for a given code |
| 3222 | * block within a test method. |
| 3223 | * |
| 3224 | * @since 5.2 |
| 3225 | */ |
| 3226 | @API(status = STABLE, since = "5.2") |
| 3227 | public static <T> T assertDoesNotThrow(ThrowingSupplier<T> supplier) { |
| 3228 | return AssertDoesNotThrow.assertDoesNotThrow(supplier); |
| 3229 | } |
| 3230 | |
| 3231 | /** |
| 3232 | * <em>Assert</em> that execution of the supplied {@code supplier} does |
| 3233 | * <em>not</em> throw any kind of {@linkplain Throwable exception}. |
| 3234 | * |
| 3235 | * <p>If the assertion passes, the {@code supplier}'s result will be returned. |
| 3236 | * |
| 3237 | * <p>Fails with the supplied failure {@code message}. |
| 3238 | * |
| 3239 | * <h4>Usage Note</h4> |
| 3240 | * <p>Although any exception thrown from a test method will cause the test |
| 3241 | * to <em>fail</em>, there are certain use cases where it can be beneficial |
| 3242 | * to explicitly assert that an exception is not thrown for a given code |
| 3243 | * block within a test method. |
| 3244 | * |
| 3245 | * @since 5.2 |
| 3246 | */ |
| 3247 | @API(status = STABLE, since = "5.2") |
| 3248 | public static <T> T assertDoesNotThrow(ThrowingSupplier<T> supplier, String message) { |
| 3249 | return AssertDoesNotThrow.assertDoesNotThrow(supplier, message); |
| 3250 | } |
| 3251 | |
| 3252 | /** |
| 3253 | * <em>Assert</em> that execution of the supplied {@code supplier} does |
| 3254 | * <em>not</em> throw any kind of {@linkplain Throwable exception}. |
| 3255 | * |
| 3256 | * <p>If the assertion passes, the {@code supplier}'s result will be returned. |
| 3257 | * |
| 3258 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3259 | * supplied {@code messageSupplier}. |
| 3260 | * |
| 3261 | * <h4>Usage Note</h4> |
| 3262 | * <p>Although any exception thrown from a test method will cause the test |
| 3263 | * to <em>fail</em>, there are certain use cases where it can be beneficial |
| 3264 | * to explicitly assert that an exception is not thrown for a given code |
| 3265 | * block within a test method. |
| 3266 | * |
| 3267 | * @since 5.2 |
| 3268 | */ |
| 3269 | @API(status = STABLE, since = "5.2") |
| 3270 | public static <T> T assertDoesNotThrow(ThrowingSupplier<T> supplier, Supplier<String> messageSupplier) { |
| 3271 | return AssertDoesNotThrow.assertDoesNotThrow(supplier, messageSupplier); |
| 3272 | } |
| 3273 | |
| 3274 | // --- assertTimeout ------------------------------------------------------- |
| 3275 | |
| 3276 | // --- executable --- |
| 3277 | |
| 3278 | /** |
| 3279 | * <em>Assert</em> that execution of the supplied {@code executable} |
| 3280 | * completes before the given {@code timeout} is exceeded. |
| 3281 | * |
| 3282 | * <p>Note: the {@code executable} will be executed in the same thread as that |
| 3283 | * of the calling code. Consequently, execution of the {@code executable} will |
| 3284 | * not be preemptively aborted if the timeout is exceeded. |
| 3285 | * |
| 3286 | * @see #assertTimeout(Duration, Executable, String) |
| 3287 | * @see #assertTimeout(Duration, Executable, Supplier) |
| 3288 | * @see #assertTimeout(Duration, ThrowingSupplier) |
| 3289 | * @see #assertTimeout(Duration, ThrowingSupplier, String) |
| 3290 | * @see #assertTimeout(Duration, ThrowingSupplier, Supplier) |
| 3291 | * @see #assertTimeoutPreemptively(Duration, Executable) |
| 3292 | */ |
| 3293 | public static void assertTimeout(Duration timeout, Executable executable) { |
| 3294 | AssertTimeout.assertTimeout(timeout, executable); |
| 3295 | } |
| 3296 | |
| 3297 | /** |
| 3298 | * <em>Assert</em> that execution of the supplied {@code executable} |
| 3299 | * completes before the given {@code timeout} is exceeded. |
| 3300 | * |
| 3301 | * <p>Note: the {@code executable} will be executed in the same thread as that |
| 3302 | * of the calling code. Consequently, execution of the {@code executable} will |
| 3303 | * not be preemptively aborted if the timeout is exceeded. |
| 3304 | * |
| 3305 | * <p>Fails with the supplied failure {@code message}. |
| 3306 | * |
| 3307 | * @see #assertTimeout(Duration, Executable) |
| 3308 | * @see #assertTimeout(Duration, Executable, Supplier) |
| 3309 | * @see #assertTimeout(Duration, ThrowingSupplier) |
| 3310 | * @see #assertTimeout(Duration, ThrowingSupplier, String) |
| 3311 | * @see #assertTimeout(Duration, ThrowingSupplier, Supplier) |
| 3312 | * @see #assertTimeoutPreemptively(Duration, Executable, String) |
| 3313 | */ |
| 3314 | public static void assertTimeout(Duration timeout, Executable executable, String message) { |
| 3315 | AssertTimeout.assertTimeout(timeout, executable, message); |
| 3316 | } |
| 3317 | |
| 3318 | /** |
| 3319 | * <em>Assert</em> that execution of the supplied {@code executable} |
| 3320 | * completes before the given {@code timeout} is exceeded. |
| 3321 | * |
| 3322 | * <p>Note: the {@code executable} will be executed in the same thread as that |
| 3323 | * of the calling code. Consequently, execution of the {@code executable} will |
| 3324 | * not be preemptively aborted if the timeout is exceeded. |
| 3325 | * |
| 3326 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3327 | * supplied {@code messageSupplier}. |
| 3328 | * |
| 3329 | * @see #assertTimeout(Duration, Executable) |
| 3330 | * @see #assertTimeout(Duration, Executable, String) |
| 3331 | * @see #assertTimeout(Duration, ThrowingSupplier) |
| 3332 | * @see #assertTimeout(Duration, ThrowingSupplier, String) |
| 3333 | * @see #assertTimeout(Duration, ThrowingSupplier, Supplier) |
| 3334 | * @see #assertTimeoutPreemptively(Duration, Executable, Supplier) |
| 3335 | */ |
| 3336 | public static void assertTimeout(Duration timeout, Executable executable, Supplier<String> messageSupplier) { |
| 3337 | AssertTimeout.assertTimeout(timeout, executable, messageSupplier); |
| 3338 | } |
| 3339 | |
| 3340 | // --- supplier --- |
| 3341 | |
| 3342 | /** |
| 3343 | * <em>Assert</em> that execution of the supplied {@code supplier} |
| 3344 | * completes before the given {@code timeout} is exceeded. |
| 3345 | * |
| 3346 | * <p>If the assertion passes then the {@code supplier}'s result is returned. |
| 3347 | * |
| 3348 | * <p>Note: the {@code supplier} will be executed in the same thread as that |
| 3349 | * of the calling code. Consequently, execution of the {@code supplier} will |
| 3350 | * not be preemptively aborted if the timeout is exceeded. |
| 3351 | * |
| 3352 | * @see #assertTimeout(Duration, Executable) |
| 3353 | * @see #assertTimeout(Duration, Executable, String) |
| 3354 | * @see #assertTimeout(Duration, Executable, Supplier) |
| 3355 | * @see #assertTimeout(Duration, ThrowingSupplier, String) |
| 3356 | * @see #assertTimeout(Duration, ThrowingSupplier, Supplier) |
| 3357 | * @see #assertTimeoutPreemptively(Duration, Executable) |
| 3358 | */ |
| 3359 | public static <T> T assertTimeout(Duration timeout, ThrowingSupplier<T> supplier) { |
| 3360 | return AssertTimeout.assertTimeout(timeout, supplier); |
| 3361 | } |
| 3362 | |
| 3363 | /** |
| 3364 | * <em>Assert</em> that execution of the supplied {@code supplier} |
| 3365 | * completes before the given {@code timeout} is exceeded. |
| 3366 | * |
| 3367 | * <p>If the assertion passes then the {@code supplier}'s result is returned. |
| 3368 | * |
| 3369 | * <p>Note: the {@code supplier} will be executed in the same thread as that |
| 3370 | * of the calling code. Consequently, execution of the {@code supplier} will |
| 3371 | * not be preemptively aborted if the timeout is exceeded. |
| 3372 | * |
| 3373 | * <p>Fails with the supplied failure {@code message}. |
| 3374 | * |
| 3375 | * @see #assertTimeout(Duration, Executable) |
| 3376 | * @see #assertTimeout(Duration, Executable, String) |
| 3377 | * @see #assertTimeout(Duration, Executable, Supplier) |
| 3378 | * @see #assertTimeout(Duration, ThrowingSupplier) |
| 3379 | * @see #assertTimeout(Duration, ThrowingSupplier, Supplier) |
| 3380 | * @see #assertTimeoutPreemptively(Duration, Executable, String) |
| 3381 | */ |
| 3382 | public static <T> T assertTimeout(Duration timeout, ThrowingSupplier<T> supplier, String message) { |
| 3383 | return AssertTimeout.assertTimeout(timeout, supplier, message); |
| 3384 | } |
| 3385 | |
| 3386 | /** |
| 3387 | * <em>Assert</em> that execution of the supplied {@code supplier} |
| 3388 | * completes before the given {@code timeout} is exceeded. |
| 3389 | * |
| 3390 | * <p>If the assertion passes then the {@code supplier}'s result is returned. |
| 3391 | * |
| 3392 | * <p>Note: the {@code supplier} will be executed in the same thread as that |
| 3393 | * of the calling code. Consequently, execution of the {@code supplier} will |
| 3394 | * not be preemptively aborted if the timeout is exceeded. |
| 3395 | * |
| 3396 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3397 | * supplied {@code messageSupplier}. |
| 3398 | * |
| 3399 | * @see #assertTimeout(Duration, Executable) |
| 3400 | * @see #assertTimeout(Duration, Executable, String) |
| 3401 | * @see #assertTimeout(Duration, Executable, Supplier) |
| 3402 | * @see #assertTimeout(Duration, ThrowingSupplier) |
| 3403 | * @see #assertTimeout(Duration, ThrowingSupplier, String) |
| 3404 | * @see #assertTimeoutPreemptively(Duration, Executable, Supplier) |
| 3405 | */ |
| 3406 | public static <T> T assertTimeout(Duration timeout, ThrowingSupplier<T> supplier, |
| 3407 | Supplier<String> messageSupplier) { |
| 3408 | return AssertTimeout.assertTimeout(timeout, supplier, messageSupplier); |
| 3409 | } |
| 3410 | |
| 3411 | // --- executable - preemptively --- |
| 3412 | |
| 3413 | /** |
| 3414 | * <em>Assert</em> that execution of the supplied {@code executable} |
| 3415 | * completes before the given {@code timeout} is exceeded. |
| 3416 | * |
| 3417 | * <p>See the {@linkplain Assertions Preemptive Timeouts} section of the |
| 3418 | * class-level Javadoc for further details. |
| 3419 | * |
| 3420 | * @see #assertTimeoutPreemptively(Duration, Executable, String) |
| 3421 | * @see #assertTimeoutPreemptively(Duration, Executable, Supplier) |
| 3422 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier) |
| 3423 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, String) |
| 3424 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier) |
| 3425 | * @see #assertTimeout(Duration, Executable) |
| 3426 | */ |
| 3427 | public static void assertTimeoutPreemptively(Duration timeout, Executable executable) { |
| 3428 | AssertTimeoutPreemptively.assertTimeoutPreemptively(timeout, executable); |
| 3429 | } |
| 3430 | |
| 3431 | /** |
| 3432 | * <em>Assert</em> that execution of the supplied {@code executable} |
| 3433 | * completes before the given {@code timeout} is exceeded. |
| 3434 | * |
| 3435 | * <p>See the {@linkplain Assertions Preemptive Timeouts} section of the |
| 3436 | * class-level Javadoc for further details. |
| 3437 | * |
| 3438 | * <p>Fails with the supplied failure {@code message}. |
| 3439 | * |
| 3440 | * @see #assertTimeoutPreemptively(Duration, Executable) |
| 3441 | * @see #assertTimeoutPreemptively(Duration, Executable, Supplier) |
| 3442 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier) |
| 3443 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, String) |
| 3444 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier) |
| 3445 | * @see #assertTimeout(Duration, Executable, String) |
| 3446 | */ |
| 3447 | public static void assertTimeoutPreemptively(Duration timeout, Executable executable, String message) { |
| 3448 | AssertTimeoutPreemptively.assertTimeoutPreemptively(timeout, executable, message); |
| 3449 | } |
| 3450 | |
| 3451 | /** |
| 3452 | * <em>Assert</em> that execution of the supplied {@code executable} |
| 3453 | * completes before the given {@code timeout} is exceeded. |
| 3454 | * |
| 3455 | * <p>See the {@linkplain Assertions Preemptive Timeouts} section of the |
| 3456 | * class-level Javadoc for further details. |
| 3457 | * |
| 3458 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3459 | * supplied {@code messageSupplier}. |
| 3460 | * |
| 3461 | * @see #assertTimeoutPreemptively(Duration, Executable) |
| 3462 | * @see #assertTimeoutPreemptively(Duration, Executable, String) |
| 3463 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier) |
| 3464 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, String) |
| 3465 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier) |
| 3466 | * @see #assertTimeout(Duration, Executable, Supplier) |
| 3467 | */ |
| 3468 | public static void assertTimeoutPreemptively(Duration timeout, Executable executable, |
| 3469 | Supplier<String> messageSupplier) { |
| 3470 | AssertTimeoutPreemptively.assertTimeoutPreemptively(timeout, executable, messageSupplier); |
| 3471 | } |
| 3472 | |
| 3473 | // --- supplier - preemptively --- |
| 3474 | |
| 3475 | /** |
| 3476 | * <em>Assert</em> that execution of the supplied {@code supplier} |
| 3477 | * completes before the given {@code timeout} is exceeded. |
| 3478 | * |
| 3479 | * <p>See the {@linkplain Assertions Preemptive Timeouts} section of the |
| 3480 | * class-level Javadoc for further details. |
| 3481 | * |
| 3482 | * <p>If the assertion passes then the {@code supplier}'s result is returned. |
| 3483 | * |
| 3484 | * @see #assertTimeoutPreemptively(Duration, Executable) |
| 3485 | * @see #assertTimeoutPreemptively(Duration, Executable, String) |
| 3486 | * @see #assertTimeoutPreemptively(Duration, Executable, Supplier) |
| 3487 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, String) |
| 3488 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier) |
| 3489 | * @see #assertTimeout(Duration, Executable) |
| 3490 | */ |
| 3491 | public static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier) { |
| 3492 | return AssertTimeoutPreemptively.assertTimeoutPreemptively(timeout, supplier); |
| 3493 | } |
| 3494 | |
| 3495 | /** |
| 3496 | * <em>Assert</em> that execution of the supplied {@code supplier} |
| 3497 | * completes before the given {@code timeout} is exceeded. |
| 3498 | * |
| 3499 | * <p>See the {@linkplain Assertions Preemptive Timeouts} section of the |
| 3500 | * class-level Javadoc for further details. |
| 3501 | * |
| 3502 | * <p>If the assertion passes then the {@code supplier}'s result is returned. |
| 3503 | * |
| 3504 | * <p>Fails with the supplied failure {@code message}. |
| 3505 | * |
| 3506 | * @see #assertTimeoutPreemptively(Duration, Executable) |
| 3507 | * @see #assertTimeoutPreemptively(Duration, Executable, String) |
| 3508 | * @see #assertTimeoutPreemptively(Duration, Executable, Supplier) |
| 3509 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier) |
| 3510 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier) |
| 3511 | * @see #assertTimeout(Duration, Executable, String) |
| 3512 | */ |
| 3513 | public static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, String message) { |
| 3514 | return AssertTimeoutPreemptively.assertTimeoutPreemptively(timeout, supplier, message); |
| 3515 | } |
| 3516 | |
| 3517 | /** |
| 3518 | * <em>Assert</em> that execution of the supplied {@code supplier} |
| 3519 | * completes before the given {@code timeout} is exceeded. |
| 3520 | * |
| 3521 | * <p>See the {@linkplain Assertions Preemptive Timeouts} section of the |
| 3522 | * class-level Javadoc for further details. |
| 3523 | * |
| 3524 | * <p>If the assertion passes then the {@code supplier}'s result is returned. |
| 3525 | * |
| 3526 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3527 | * supplied {@code messageSupplier}. |
| 3528 | * |
| 3529 | * @see #assertTimeoutPreemptively(Duration, Executable) |
| 3530 | * @see #assertTimeoutPreemptively(Duration, Executable, String) |
| 3531 | * @see #assertTimeoutPreemptively(Duration, Executable, Supplier) |
| 3532 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier) |
| 3533 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, String) |
| 3534 | * @see #assertTimeout(Duration, Executable, Supplier) |
| 3535 | */ |
| 3536 | public static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, |
| 3537 | Supplier<String> messageSupplier) { |
| 3538 | return AssertTimeoutPreemptively.assertTimeoutPreemptively(timeout, supplier, messageSupplier); |
| 3539 | } |
| 3540 | |
| 3541 | /** |
| 3542 | * <em>Assert</em> that execution of the supplied {@code supplier} |
| 3543 | * completes before the given {@code timeout} is exceeded. |
| 3544 | * |
| 3545 | * <p>See the {@linkplain Assertions Preemptive Timeouts} section of the |
| 3546 | * class-level Javadoc for further details. |
| 3547 | * |
| 3548 | * <p>If the assertion passes then the {@code supplier}'s result is returned. |
| 3549 | * |
| 3550 | * <p>In the case the assertion does not pass, the supplied |
| 3551 | * {@link TimeoutFailureFactory} is invoked to create an exception which is |
| 3552 | * then thrown. |
| 3553 | * |
| 3554 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3555 | * supplied {@code messageSupplier}. |
| 3556 | * |
| 3557 | * @see #assertTimeoutPreemptively(Duration, Executable) |
| 3558 | * @see #assertTimeoutPreemptively(Duration, Executable, String) |
| 3559 | * @see #assertTimeoutPreemptively(Duration, Executable, Supplier) |
| 3560 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier) |
| 3561 | * @see #assertTimeoutPreemptively(Duration, ThrowingSupplier, String) |
| 3562 | * @see #assertTimeout(Duration, Executable, Supplier) |
| 3563 | */ |
| 3564 | @API(status = INTERNAL, since = "5.9.1") |
| 3565 | public static <T, E extends Throwable> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, |
| 3566 | Supplier<String> messageSupplier, TimeoutFailureFactory<E> failureFactory) throws E { |
| 3567 | return AssertTimeoutPreemptively.assertTimeoutPreemptively(timeout, supplier, messageSupplier, failureFactory); |
| 3568 | } |
| 3569 | |
| 3570 | // --- assertInstanceOf ---------------------------------------------------- |
| 3571 | |
| 3572 | /** |
| 3573 | * <em>Assert</em> that the supplied {@code actualValue} is an instance of the |
| 3574 | * {@code expectedType}. |
| 3575 | * |
| 3576 | * <p>Like the {@code instanceof} operator a {@code null} value is not |
| 3577 | * considered to be of the {@code expectedType} and does not pass the assertion. |
| 3578 | * |
| 3579 | * @since 5.8 |
| 3580 | */ |
| 3581 | @API(status = STABLE, since = "5.10") |
| 3582 | public static <T> T assertInstanceOf(Class<T> expectedType, Object actualValue) { |
| 3583 | return AssertInstanceOf.assertInstanceOf(expectedType, actualValue); |
| 3584 | } |
| 3585 | |
| 3586 | /** |
| 3587 | * <em>Assert</em> that the supplied {@code actualValue} is an instance of the |
| 3588 | * {@code expectedType}. |
| 3589 | * |
| 3590 | * <p>Like the {@code instanceof} operator a {@code null} value is not |
| 3591 | * considered to be of the {@code expectedType} and does not pass the assertion. |
| 3592 | * |
| 3593 | * <p>Fails with the supplied failure {@code message}. |
| 3594 | * |
| 3595 | * @since 5.8 |
| 3596 | */ |
| 3597 | @API(status = STABLE, since = "5.10") |
| 3598 | public static <T> T assertInstanceOf(Class<T> expectedType, Object actualValue, String message) { |
| 3599 | return AssertInstanceOf.assertInstanceOf(expectedType, actualValue, message); |
| 3600 | } |
| 3601 | |
| 3602 | /** |
| 3603 | * <em>Assert</em> that the supplied {@code actualValue} is an instance of the |
| 3604 | * {@code expectedType}. |
| 3605 | * |
| 3606 | * <p>Like the {@code instanceof} operator a {@code null} value is not |
| 3607 | * considered to be of the {@code expectedType} and does not pass the assertion. |
| 3608 | * |
| 3609 | * <p>If necessary, the failure message will be retrieved lazily from the |
| 3610 | * supplied {@code messageSupplier}. |
| 3611 | * |
| 3612 | * @since 5.8 |
| 3613 | */ |
| 3614 | @API(status = STABLE, since = "5.10") |
| 3615 | public static <T> T assertInstanceOf(Class<T> expectedType, Object actualValue, Supplier<String> messageSupplier) { |
| 3616 | return AssertInstanceOf.assertInstanceOf(expectedType, actualValue, messageSupplier); |
| 3617 | } |
| 3618 | |
| 3619 | /** |
| 3620 | * Factory for timeout failures. |
| 3621 | * |
| 3622 | * @param <T> The type of error or exception created |
| 3623 | * @since 5.9.1 |
| 3624 | * @see Assertions#assertTimeoutPreemptively(Duration, ThrowingSupplier, Supplier, TimeoutFailureFactory) |
| 3625 | */ |
| 3626 | @API(status = INTERNAL, since = "5.9.1") |
| 3627 | public interface TimeoutFailureFactory<T extends Throwable> { |
| 3628 | |
| 3629 | /** |
| 3630 | * Create a failure for the given timeout, message, and cause. |
| 3631 | * |
| 3632 | * @return timeout failure; never {@code null} |
| 3633 | */ |
| 3634 | T createTimeoutFailure(Duration timeout, Supplier<String> messageSupplier, Throwable cause); |
| 3635 | } |
| 3636 | } |