How to use given_the_assumption_is_met_the_test_is_executed method of org.assertj.core.api.BDDAssumptions class

Best Assertj code snippet using org.assertj.core.api.BDDAssumptions.given_the_assumption_is_met_the_test_is_executed

Source:BDDAssumptions.java Github

copy

Full Screen

...85 * then(fellowshipOfTheRing).contains("Sauron");86 * }87 *88 * {@literal @Test}89 * public void given_the_assumption_is_met_the_test_is_executed() {90 * given(hobbit).isEqualTo("HOBBIT");91 * // ... following code is executed92 * then(fellowshipOfTheRing).doesNotContain("Sauron");93 * }</code></pre>94 *95 * @since 3.14.096 * @author Gonzalo Müller97 */98@CheckReturnValue99public final class BDDAssumptions extends Assumptions {100 private BDDAssumptions() {}101 /**102 * Creates a new assumption's instance for a <code>boolean</code> value.103 * <p>104 * Examples:105 * <p>106 * Executed test:107 * <pre><code class='java'> {@literal @Test}108 * public void given_the_assumption_is_met_the_test_is_executed() {109 * given(true).isTrue();110 * // the remaining code is executed111 * // ...112 * }</code></pre>113 * <p>114 * Skipped test:115 * <pre><code class='java'> {@literal @Test}116 * public void given_the_assumption_is_not_met_the_test_is_skipped() {117 * given(true).isFalse();118 * // the remaining code is NOT executed.119 * // ...120 *}</code></pre>121 *122 * @param actual the actual <code>boolean</code> value to be validated.123 * @return the {@link AbstractBooleanAssert} assertion object to be used for assumptions.124 * @since 3.14.0125 */126 public static AbstractBooleanAssert<?> given(boolean actual) {127 return assumeThat(actual);128 }129 /**130 * Creates a new assumption's instance for a {@link Boolean} value.131 * <p>132 * Examples:133 * <p>134 * Executed test:135 * <pre><code class='java'> {@literal @Test}136 * public void given_the_assumption_is_met_the_test_is_executed() {137 * given(Boolean.valueOf(true)).isTrue();138 * // the remaining code is executed139 * // ...140 * }</code></pre>141 * <p>142 * Skipped test:143 * <pre><code class='java'> {@literal @Test}144 * public void given_the_assumption_is_not_met_the_test_is_skipped() {145 * given(Boolean.valueOf(true)).isFalse();146 * // the remaining code is NOT executed.147 * // ...148 *}</code></pre>149 *150 * @param actual the actual {@link Boolean} value to be validated.151 * @return the {@link AbstractBooleanAssert} assertion object to be used for assumptions.152 * @since 3.14.0153 */154 public static AbstractBooleanAssert<?> given(Boolean actual) {155 return assumeThat(actual);156 }157 /**158 * Creates a new assumption's instance for a <code>boolean</code>s' array.159 * <p>160 * Examples:161 * <p>162 * Executed test:163 * <pre><code class='java'> {@literal @Test}164 * public void given_the_assumption_is_met_the_test_is_executed() {165 * given(new boolean[] { true, true }).contains(true);166 * // the remaining code is executed167 * // ...168 * }</code></pre>169 * <p>170 * Skipped test:171 * <pre><code class='java'> {@literal @Test}172 * public void given_the_assumption_is_not_met_the_test_is_skipped() {173 * given(new boolean[] { true, true }).contains(false);174 * // the remaining code is NOT executed.175 * // ...176 *}</code></pre>177 *178 * @param actual the actual <code>boolean</code>s' array to be validated.179 * @return the {@link AbstractBooleanArrayAssert} assertion object to be used for assumptions.180 * @since 3.14.0181 */182 public static AbstractBooleanArrayAssert<?> given(boolean[] actual) {183 return assumeThat(actual);184 }185 /**186 * Creates a new assumption's instance for a <code>boolean</code>s' two-dimensional array.187 * <p>188 * Examples:189 * <p>190 * Executed test:191 * <pre><code class='java'> {@literal @Test}192 * public void given_the_assumption_is_met_the_test_is_executed() {193 * given(new boolean[][] {{true, true}, {false, false}}).contains(new boolean[] {true, true}, atIndex(0));194 * // the remaining code is executed195 * // ...196 * }</code></pre>197 * <p>198 * Skipped test:199 * <pre><code class='java'> {@literal @Test}200 * public void given_the_assumption_is_not_met_the_test_is_skipped() {201 * given(new boolean[][] {{true, true}, {false, false}}).contains(new boolean[] {true, true}, atIndex(1));202 * // the remaining code is NOT executed.203 * // ...204 *}</code></pre>205 *206 * @param actual the actual <code>boolean</code>s' two-dimensional array to be validated.207 * @return the {@link Boolean2DArrayAssert} assertion object to be used for assumptions.208 * @since 3.17.0209 */210 public static Boolean2DArrayAssert given(boolean[][] actual) {211 return assumeThat(actual);212 }213 /**214 * Creates a new assumption's instance for a <code>byte</code> value.215 * <p>216 * Examples:217 * <p>218 * Executed test:219 * <pre><code class='java'> {@literal @Test}220 * public void given_the_assumption_is_met_the_test_is_executed() {221 * given((byte) 1).isOne();222 * // the remaining code is executed223 * // ...224 * }</code></pre>225 * <p>226 * Skipped test:227 * <pre><code class='java'> {@literal @Test}228 * public void given_the_assumption_is_not_met_the_test_is_skipped() {229 * given((byte) 1).isZero();230 * // the remaining code is NOT executed.231 * // ...232 *}</code></pre>233 *234 * @param actual the actual <code>byte</code> value to be validated.235 * @return the {@link AbstractByteAssert} assertion object to be used for assumptions.236 * @since 3.14.0237 */238 public static AbstractByteAssert<?> given(byte actual) {239 return assumeThat(actual);240 }241 /**242 * Creates a new assumption's instance for a {@link Byte} value.243 * <p>244 * Examples:245 * <p>246 * Executed test:247 * <pre><code class='java'> {@literal @Test}248 * public void given_the_assumption_is_met_the_test_is_executed() {249 * given(Byte.valueOf("1")).isOne();250 * // the remaining code is executed251 * // ...252 * }</code></pre>253 * <p>254 * Skipped test:255 * <pre><code class='java'> {@literal @Test}256 * public void given_the_assumption_is_not_met_the_test_is_skipped() {257 * given(Byte.valueOf("1")).isZero();258 * // the remaining code is NOT executed.259 * // ...260 *}</code></pre>261 *262 * @param actual the actual {@link Byte} value to be validated.263 * @return the {@link AbstractByteAssert} assertion object to be used for assumptions.264 * @since 3.14.0265 */266 public static AbstractByteAssert<?> given(Byte actual) {267 return assumeThat(actual);268 }269 /**270 * Creates a new assumption's instance for a <code>byte</code>s' array.271 * <p>272 * Examples:273 * <p>274 * Executed test:275 * <pre><code class='java'> {@literal @Test}276 * public void given_the_assumption_is_met_the_test_is_executed() {277 * given(new byte[] { 1, 2 }).contains((byte) 1);278 * // the remaining code is executed279 * // ...280 * }</code></pre>281 * <p>282 * Skipped test:283 * <pre><code class='java'> {@literal @Test}284 * public void given_the_assumption_is_not_met_the_test_is_skipped() {285 * given(new byte[] { 1, 2 }).contains((byte) 0);286 * // the remaining code is NOT executed.287 * // ...288 *}</code></pre>289 *290 * @param actual the actual bytes' array to be validated.291 * @return the {@link AbstractByteArrayAssert} assertion object to be used for assumptions.292 * @since 3.14.0293 */294 public static AbstractByteArrayAssert<?> given(byte[] actual) {295 return assumeThat(actual);296 }297 /**298 * Creates a new assumption's instance for a <code>byte</code>s' two-dimensional array.299 * <p>300 * Examples:301 * <p>302 * Executed test:303 * <pre><code class='java'> {@literal @Test}304 * public void given_the_assumption_is_met_the_test_is_executed() {305 * given(new byte[][] {{1, 2}, {3, 4}}).contains(new byte[] {1, 2)}, atIndex(0));306 * // the remaining code is executed307 * // ...308 * }</code></pre>309 * <p>310 * Skipped test:311 * <pre><code class='java'> {@literal @Test}312 * public void given_the_assumption_is_not_met_the_test_is_skipped() {313 * given(new byte[][] {{1, 2}, {3, 4}}).contains(new byte[] {1, 2)}, atIndex(1));314 * // the remaining code is NOT executed.315 * // ...316 *}</code></pre>317 *318 * @param actual the actual bytes' two-dimensional array to be validated.319 * @return the {@link Byte2DArrayAssert} assertion object to be used for assumptions.320 * @since 3.17.0321 */322 public static Byte2DArrayAssert given(byte[][] actual) {323 return assumeThat(actual);324 }325 /**326 * Creates a new assumption's instance for a <code>short</code> value.327 * <p>328 * Examples:329 * <p>330 * Executed test:331 * <pre><code class='java'> {@literal @Test}332 * public void given_the_assumption_is_met_the_test_is_executed() {333 * given((short) 1).isOne();334 * // the remaining code is executed335 * // ...336 * }</code></pre>337 * <p>338 * Skipped test:339 * <pre><code class='java'> {@literal @Test}340 * public void given_the_assumption_is_not_met_the_test_is_skipped() {341 * given((short) 1).isZero();342 * // the remaining code is NOT executed.343 * // ...344 *}</code></pre>345 *346 * @param actual the actual <code>short</code> value to be validated.347 * @return the {@link AbstractShortAssert} assertion object to be used for assumptions.348 * @since 3.14.0349 */350 public static AbstractShortAssert<?> given(short actual) {351 return assumeThat(actual);352 }353 /**354 * Creates a new assumption's instance for a {@link Short} value.355 * <p>356 * Examples:357 * <p>358 * Executed test:359 * <pre><code class='java'> {@literal @Test}360 * public void given_the_assumption_is_met_the_test_is_executed() {361 * given(Short.valueOf("1")).isOne();362 * // the remaining code is executed363 * // ...364 * }</code></pre>365 * <p>366 * Skipped test:367 * <pre><code class='java'> {@literal @Test}368 * public void given_the_assumption_is_not_met_the_test_is_skipped() {369 * given(Short.valueOf("1")).isZero();370 * // the remaining code is NOT executed.371 * // ...372 *}</code></pre>373 *374 * @param actual the actual {@link Short} value to be validated.375 * @return the {@link AbstractShortAssert} assertion object to be used for assumptions.376 * @since 3.14.0377 */378 public static AbstractShortAssert<?> given(Short actual) {379 return assumeThat(actual);380 }381 /**382 * Creates a new assumption's instance for a <code>short</code>s' array.383 * <p>384 * Examples:385 * <p>386 * Executed test:387 * <pre><code class='java'> {@literal @Test}388 * public void given_the_assumption_is_met_the_test_is_executed() {389 * given(new short[] { 1, 2 }).contains((short) 1);390 * // the remaining code is executed391 * // ...392 * }</code></pre>393 * <p>394 * Skipped test:395 * <pre><code class='java'> {@literal @Test}396 * public void given_the_assumption_is_not_met_the_test_is_skipped() {397 * given(new short[] { 1, 2 }).contains((short) 0);398 * // the remaining code is NOT executed.399 * // ...400 *}</code></pre>401 *402 * @param actual the actual <code>short</code>s' array to be validated.403 * @return the {@link AbstractShortArrayAssert} assertion object to be used for assumptions.404 * @since 3.14.0405 */406 public static AbstractShortArrayAssert<?> given(short[] actual) {407 return assumeThat(actual);408 }409 /**410 * Creates a new assumption's instance for a <code>short</code>s' two-dimensional array.411 * <p>412 * Examples:413 * <p>414 * Executed test:415 * <pre><code class='java'> {@literal @Test}416 * public void given_the_assumption_is_met_the_test_is_executed() {417 * given(new short[][] {{1, 2}, {3, 4}}).contains(new short[] {1, 2}, atIndex(0));418 * // the remaining code is executed419 * // ...420 * }</code></pre>421 * <p>422 * Skipped test:423 * <pre><code class='java'> {@literal @Test}424 * public void given_the_assumption_is_not_met_the_test_is_skipped() {425 * given(new short[][] {{1, 2}, {3, 4}}).contains(new short[] {1, 2}, atIndex(1));426 * // the remaining code is NOT executed.427 * // ...428 *}</code></pre>429 *430 * @param actual the actual <code>short</code>s' two-dimensional array to be validated.431 * @return the {@link Short2DArrayAssert} assertion object to be used for assumptions.432 * @since 3.17.0433 */434 public static Short2DArrayAssert given(short[][] actual) {435 return assumeThat(actual);436 }437 /**438 * Creates a new assumption's instance for an <code>int</code> value.439 * <p>440 * Examples:441 * <p>442 * Executed test:443 * <pre><code class='java'> {@literal @Test}444 * public void given_the_assumption_is_met_the_test_is_executed() {445 * given(1).isOne();446 * // the remaining code is executed447 * // ...448 * }</code></pre>449 * <p>450 * Skipped test:451 * <pre><code class='java'> {@literal @Test}452 * public void given_the_assumption_is_not_met_the_test_is_skipped() {453 * given(1).isZero();454 * // the remaining code is NOT executed.455 * // ...456 *}</code></pre>457 *458 * @param actual the actual <code>int</code> value to be validated.459 * @return the {@link AbstractIntegerAssert} assertion object to be used for assumptions.460 * @since 3.14.0461 */462 public static AbstractIntegerAssert<?> given(int actual) {463 return assumeThat(actual);464 }465 /**466 * Creates a new assumption's instance for an {@link Integer} value.467 * <p>468 * Examples:469 * <p>470 * Executed test:471 * <pre><code class='java'> {@literal @Test}472 * public void given_the_assumption_is_met_the_test_is_executed() {473 * given(Integer.valueOf("1")).isOne();474 * // the remaining code is executed475 * // ...476 * }</code></pre>477 * <p>478 * Skipped test:479 * <pre><code class='java'> {@literal @Test}480 * public void given_the_assumption_is_not_met_the_test_is_skipped() {481 * given(Integer.valueOf("1")).isZero();482 * // the remaining code is NOT executed.483 * // ...484 *}</code></pre>485 *486 * @param actual the actual {@link Integer} value to be validated.487 * @return the {@link AbstractIntegerAssert} assertion object to be used for assumptions.488 * @since 3.14.0489 */490 public static AbstractIntegerAssert<?> given(Integer actual) {491 return assumeThat(actual);492 }493 /**494 * Creates a new assumption's instance for an <code>int</code>s' array.495 * <p>496 * Examples:497 * <p>498 * Executed test:499 * <pre><code class='java'> {@literal @Test}500 * public void given_the_assumption_is_met_the_test_is_executed() {501 * given(new int[] { 1, 2 }).contains((short) 1);502 * // the remaining code is executed503 * // ...504 * }</code></pre>505 * <p>506 * Skipped test:507 * <pre><code class='java'> {@literal @Test}508 * public void given_the_assumption_is_not_met_the_test_is_skipped() {509 * given(new int[] { 1, 2 }).contains((short) 0);510 * // the remaining code is NOT executed.511 * // ...512 *}</code></pre>513 *514 * @param actual the actual <code>int</code>s' array to be validated.515 * @return the {@link AbstractIntArrayAssert} assertion object to be used for assumptions.516 * @since 3.14.0517 */518 public static AbstractIntArrayAssert<?> given(int[] actual) {519 return assumeThat(actual);520 }521 /**522 * Creates a new assumption's instance for an <code>int</code>s' two-dimensional array.523 * <p>524 * Examples:525 * <p>526 * Executed test:527 * <pre><code class='java'> {@literal @Test}528 * public void given_the_assumption_is_met_the_test_is_executed() {529 * given(new int[][] {{1, 2}, {3, 4}}).contains(new int[] {1, 2}, atIndex(0));530 * // the remaining code is executed531 * // ...532 * }</code></pre>533 * <p>534 * Skipped test:535 * <pre><code class='java'> {@literal @Test}536 * public void given_the_assumption_is_not_met_the_test_is_skipped() {537 * given(new int[][] {{1, 2}, {3, 4}}).contains(new int[] {1, 2}, atIndex(1));538 * // the remaining code is NOT executed.539 * // ...540 *}</code></pre>541 *542 * @param actual the actual <code>int</code>s' two-dimensional array to be validated.543 * @return the {@link Int2DArrayAssert} assertion object to be used for assumptions.544 * @since 3.17.0545 */546 public static Int2DArrayAssert given(int[][] actual) {547 return assumeThat(actual);548 }549 /**550 * Creates a new assumption's instance for a {@link BigInteger} value.551 * <p>552 * Examples:553 * <p>554 * Executed test:555 * <pre><code class='java'> {@literal @Test}556 * public void given_the_assumption_is_met_the_test_is_executed() {557 * given(BigInteger.valueOf(1L)).isOne();558 * // the remaining code is executed559 * // ...560 * }</code></pre>561 * <p>562 * Skipped test:563 * <pre><code class='java'> {@literal @Test}564 * public void given_the_assumption_is_not_met_the_test_is_skipped() {565 * given(BigInteger.valueOf(1L)).isZero();566 * // the remaining code is NOT executed.567 * // ...568 *}</code></pre>569 *570 * @param actual the actual {@link BigInteger} value to be validated.571 * @return the {@link AbstractBigIntegerAssert} assertion object to be used for assumptions.572 * @since 3.14.0573 */574 public static AbstractBigIntegerAssert<?> given(BigInteger actual) {575 return assumeThat(actual);576 }577 /**578 * Creates a new assumption's instance for a <code>long</code> value.579 * <p>580 * Examples:581 * <p>582 * Executed test:583 * <pre><code class='java'> {@literal @Test}584 * public void given_the_assumption_is_met_the_test_is_executed() {585 * given(1L).isOne();586 * // the remaining code is executed587 * // ...588 * }</code></pre>589 * <p>590 * Skipped test:591 * <pre><code class='java'> {@literal @Test}592 * public void given_the_assumption_is_not_met_the_test_is_skipped() {593 * given(1L).isZero();594 * // the remaining code is NOT executed.595 * // ...596 *}</code></pre>597 *598 * @param actual the actual <code>long</code> value to be validated.599 * @return the {@link AbstractLongAssert} assertion object to be used for assumptions.600 * @since 3.14.0601 */602 public static AbstractLongAssert<?> given(long actual) {603 return assumeThat(actual);604 }605 /**606 * Creates a new assumption's instance for a {@link Long} value.607 * <p>608 * Examples:609 * <p>610 * Executed test:611 * <pre><code class='java'> {@literal @Test}612 * public void given_the_assumption_is_met_the_test_is_executed() {613 * given(Long.valueOf(1L)).isOne();614 * // the remaining code is executed615 * // ...616 * }</code></pre>617 * <p>618 * Skipped test:619 * <pre><code class='java'> {@literal @Test}620 * public void given_the_assumption_is_not_met_the_test_is_skipped() {621 * given(Long.valueOf(1L)).isZero();622 * // the remaining code is NOT executed.623 * // ...624 *}</code></pre>625 *626 * @param actual the actual {@link Long} value to be validated.627 * @return the {@link AbstractLongAssert} assertion object to be used for assumptions.628 * @since 3.14.0629 */630 public static AbstractLongAssert<?> given(Long actual) {631 return assumeThat(actual);632 }633 /**634 * Creates a new assumption's instance for a <code>long</code>s' array.635 * <p>636 * Examples:637 * <p>638 * Executed test:639 * <pre><code class='java'> {@literal @Test}640 * public void given_the_assumption_is_met_the_test_is_executed() {641 * given(new long[] { 1, 2 }).contains(1L);642 * // the remaining code is executed643 * // ...644 * }</code></pre>645 * <p>646 * Skipped test:647 * <pre><code class='java'> {@literal @Test}648 * public void given_the_assumption_is_not_met_the_test_is_skipped() {649 * given(new long[] { 1, 2 }).contains(0L);650 * // the remaining code is NOT executed.651 * // ...652 *}</code></pre>653 *654 * @param actual the actual <code>long</code>s' array to be validated.655 * @return the {@link AbstractLongArrayAssert} assertion object to be used for assumptions.656 * @since 3.14.0657 */658 public static AbstractLongArrayAssert<?> given(long[] actual) {659 return assumeThat(actual);660 }661 /**662 * Creates a new assumption's instance for a <code>long</code>s' two-dimensional array.663 * <p>664 * Examples:665 * <p>666 * Executed test:667 * <pre><code class='java'> {@literal @Test}668 * public void given_the_assumption_is_met_the_test_is_executed() {669 * given(new long[][] {{1, 2}, {3, 4}}).contains(new long[] {1, 2}, atIndex(0));670 * // the remaining code is executed671 * // ...672 * }</code></pre>673 * <p>674 * Skipped test:675 * <pre><code class='java'> {@literal @Test}676 * public void given_the_assumption_is_not_met_the_test_is_skipped() {677 * given(new long[][] {{1, 2}, {3, 4}}).contains(new long[] {1, 2}, atIndex(1));678 * // the remaining code is NOT executed.679 * // ...680 *}</code></pre>681 *682 * @param actual the actual <code>long</code>s' two-dimensional array to be validated.683 * @return the {@link Long2DArrayAssert} assertion object to be used for assumptions.684 * @since 3.17.0685 */686 public static Long2DArrayAssert given(long[][] actual) {687 return assumeThat(actual);688 }689 /**690 * Creates a new assumption's instance for a <code>float</code> value.691 * <p>692 * Examples:693 * <p>694 * Executed test:695 * <pre><code class='java'> {@literal @Test}696 * public void given_the_assumption_is_met_the_test_is_executed() {697 * given(1.0f).isOne();698 * // the remaining code is executed699 * // ...700 * }</code></pre>701 * <p>702 * Skipped test:703 * <pre><code class='java'> {@literal @Test}704 * public void given_the_assumption_is_not_met_the_test_is_skipped() {705 * given(1.0f).isZero();706 * // the remaining code is NOT executed.707 * // ...708 *}</code></pre>709 *710 * @param actual the actual <code>float</code> value to be validated.711 * @return the {@link AbstractFloatAssert} assertion object to be used for assumptions.712 * @since 3.14.0713 */714 public static AbstractFloatAssert<?> given(float actual) {715 return assumeThat(actual);716 }717 /**718 * Creates a new assumption's instance for a {@link Float} value.719 * <p>720 * Examples:721 * <p>722 * Executed test:723 * <pre><code class='java'> {@literal @Test}724 * public void given_the_assumption_is_met_the_test_is_executed() {725 * given(Float.valueOf(1.0f)).isOne();726 * // the remaining code is executed727 * // ...728 * }</code></pre>729 * <p>730 * Skipped test:731 * <pre><code class='java'> {@literal @Test}732 * public void given_the_assumption_is_not_met_the_test_is_skipped() {733 * given(Float.valueOf(1.0f)).isZero();734 * // the remaining code is NOT executed.735 * // ...736 *}</code></pre>737 *738 * @param actual the actual {@link Float} value to be validated.739 * @return the {@link AbstractFloatAssert} assertion object to be used for assumptions.740 * @since 3.14.0741 */742 public static AbstractFloatAssert<?> given(Float actual) {743 return assumeThat(actual);744 }745 /**746 * Creates a new assumption's instance for a <code>float</code>s' array.747 * <p>748 * Examples:749 * <p>750 * Executed test:751 * <pre><code class='java'> {@literal @Test}752 * public void given_the_assumption_is_met_the_test_is_executed() {753 * given(new float[] { 1.0f, 2.0f }).contains(1.0f);754 * // the remaining code is executed755 * // ...756 * }</code></pre>757 * <p>758 * Skipped test:759 * <pre><code class='java'> {@literal @Test}760 * public void given_the_assumption_is_not_met_the_test_is_skipped() {761 * given(new float[] { 1.0f, 2.0f }).contains(0.0f);762 * // the remaining code is NOT executed.763 * // ...764 *}</code></pre>765 *766 * @param actual the actual <code>float</code>s' array to be validated.767 * @return the {@link AbstractFloatArrayAssert} assertion object to be used for assumptions.768 * @since 3.14.0769 */770 public static AbstractFloatArrayAssert<?> given(float[] actual) {771 return assumeThat(actual);772 }773 /**774 * Creates a new assumption's instance for a <code>float</code>s' two-dimensional array.775 * <p>776 * Examples:777 * <p>778 * Executed test:779 * <pre><code class='java'> {@literal @Test}780 * public void given_the_assumption_is_met_the_test_is_executed() {781 * given(new float[][] {{1.0f, 2.0f}, {3.0f, 4.0f}}).contains(new float[] {1.0f, 2.0f}, atIndex(0));782 * // the remaining code is executed783 * // ...784 * }</code></pre>785 * <p>786 * Skipped test:787 * <pre><code class='java'> {@literal @Test}788 * public void given_the_assumption_is_not_met_the_test_is_skipped() {789 * given(new float[][] {{1.0f, 2.0f}, {3.0f, 4.0f}}).contains(new float[] {1.0f, 2.0f}, atIndex(1));790 * // the remaining code is NOT executed.791 * // ...792 *}</code></pre>793 *794 * @param actual the actual <code>float</code>s' two-dimensional array to be validated.795 * @return the {@link Float2DArrayAssert} assertion object to be used for assumptions.796 * @since 3.17.0797 */798 public static Float2DArrayAssert given(float[][] actual) {799 return assumeThat(actual);800 }801 /**802 * Creates a new assumption's instance for a <code>double</code> value.803 * <p>804 * Examples:805 * <p>806 * Executed test:807 * <pre><code class='java'> {@literal @Test}808 * public void given_the_assumption_is_met_the_test_is_executed() {809 * given(1.0).isOne();810 * // the remaining code is executed811 * // ...812 * }</code></pre>813 * <p>814 * Skipped test:815 * <pre><code class='java'> {@literal @Test}816 * public void given_the_assumption_is_not_met_the_test_is_skipped() {817 * given(1.0).isZero();818 * // the remaining code is NOT executed.819 * // ...820 *}</code></pre>821 *822 * @param actual the actual <code>double</code> value to be validated.823 * @return the {@link AbstractDoubleAssert} assertion object to be used for assumptions.824 * @since 3.14.0825 */826 public static AbstractDoubleAssert<?> given(double actual) {827 return assumeThat(actual);828 }829 /**830 * Creates a new assumption's instance for a {@link Double} value.831 * <p>832 * Examples:833 * <p>834 * Executed test:835 * <pre><code class='java'> {@literal @Test}836 * public void given_the_assumption_is_met_the_test_is_executed() {837 * given(Double.valueOf(1.0f)).isOne();838 * // the remaining code is executed839 * // ...840 * }</code></pre>841 * <p>842 * Skipped test:843 * <pre><code class='java'> {@literal @Test}844 * public void given_the_assumption_is_not_met_the_test_is_skipped() {845 * given(Double.valueOf(1.0f)).isZero();846 * // the remaining code is NOT executed.847 * // ...848 *}</code></pre>849 *850 * @param actual the actual {@link Double} value to be validated.851 * @return the {@link AbstractDoubleAssert} assertion object to be used for assumptions.852 * @since 3.14.0853 */854 public static AbstractDoubleAssert<?> given(Double actual) {855 return assumeThat(actual);856 }857 /**858 * Creates a new assumption's instance for an <code>double</code>s' array.859 * <p>860 * Examples:861 * <p>862 * Executed test:863 * <pre><code class='java'> {@literal @Test}864 * public void given_the_assumption_is_met_the_test_is_executed() {865 * given(new double[] { 1.0, 2.0 }).contains(1.0);866 * // the remaining code is executed867 * // ...868 * }</code></pre>869 * <p>870 * Skipped test:871 * <pre><code class='java'> {@literal @Test}872 * public void given_the_assumption_is_not_met_the_test_is_skipped() {873 * given(new double[] { 1.0, 2.0 }).contains(0.0);874 * // the remaining code is NOT executed.875 * // ...876 *}</code></pre>877 *878 * @param actual the actual <code>double</code>s' array to be validated.879 * @return the {@link AbstractDoubleArrayAssert} assertion object to be used for assumptions.880 * @since 3.14.0881 */882 public static AbstractDoubleArrayAssert<?> given(double[] actual) {883 return assumeThat(actual);884 }885 /**886 * Creates a new assumption's instance for an <code>double</code>s' two-dimensional array.887 * <p>888 * Examples:889 * <p>890 * Executed test:891 * <pre><code class='java'> {@literal @Test}892 * public void given_the_assumption_is_met_the_test_is_executed() {893 * given(new double[][] {{1.0, 2.0}, {3.0, 4.0}}).contains(new double[] {1.0, 2.0}, atIndex(0));894 * // the remaining code is executed895 * // ...896 * }</code></pre>897 * <p>898 * Skipped test:899 * <pre><code class='java'> {@literal @Test}900 * public void given_the_assumption_is_not_met_the_test_is_skipped() {901 * given(new double[][] {{1.0, 2.0}, {3.0, 4.0}}).contains(new double[] {1.0, 2.0}, atIndex(1));902 * // the remaining code is NOT executed.903 * // ...904 *}</code></pre>905 *906 * @param actual the actual <code>double</code>s' two-dimensional array to be validated.907 * @return the {@link Double2DArrayAssert} assertion object to be used for assumptions.908 * @since 3.17.0909 */910 public static Double2DArrayAssert given(double[][] actual) {911 return assumeThat(actual);912 }913 /**914 * Creates a new assumption's instance for a {@link BigDecimal} value.915 * <p>916 * Examples:917 * <p>918 * Executed test:919 * <pre><code class='java'> {@literal @Test}920 * public void given_the_assumption_is_met_the_test_is_executed() {921 * given(BigDecimal.valueOf(1.0)).isOne();922 * // the remaining code is executed923 * // ...924 * }</code></pre>925 * <p>926 * Skipped test:927 * <pre><code class='java'> {@literal @Test}928 * public void given_the_assumption_is_not_met_the_test_is_skipped() {929 * given(BigDecimal.valueOf(1.0)).isZero();930 * // the remaining code is NOT executed.931 * // ...932 *}</code></pre>933 *934 * @param actual the actual {@link BigDecimal} value to be validated.935 * @return the {@link AbstractBigDecimalAssert} assertion object to be used for assumptions.936 * @since 3.14.0937 */938 public static AbstractBigDecimalAssert<?> given(BigDecimal actual) {939 return assumeThat(actual);940 }941 /**942 * Creates a new assumption's instance for a <code>char</code> value.943 * <p>944 * Examples:945 * <p>946 * Executed test:947 * <pre><code class='java'> {@literal @Test}948 * public void given_the_assumption_is_met_the_test_is_executed() {949 * given('A').isUpperCase();950 * // the remaining code is executed951 * // ...952 * }</code></pre>953 * <p>954 * Skipped test:955 * <pre><code class='java'> {@literal @Test}956 * public void given_the_assumption_is_not_met_the_test_is_skipped() {957 * given('A').isLowerCase();958 * // the remaining code is NOT executed.959 * // ...960 *}</code></pre>961 *962 * @param actual the actual <code>char</code> value to be validated.963 * @return the {@link AbstractCharacterAssert} assertion object to be used for assumptions.964 * @since 3.14.0965 */966 public static AbstractCharacterAssert<?> given(char actual) {967 return assumeThat(actual);968 }969 /**970 * Creates a new assumption's instance for a {@link Character} value.971 * <p>972 * Examples:973 * <p>974 * Executed test:975 * <pre><code class='java'> {@literal @Test}976 * public void given_the_assumption_is_met_the_test_is_executed() {977 * given(Character.valueOf('A')).isUpperCase();978 * // the remaining code is executed979 * // ...980 * }</code></pre>981 * <p>982 * Skipped test:983 * <pre><code class='java'> {@literal @Test}984 * public void given_the_assumption_is_not_met_the_test_is_skipped() {985 * given(Character.valueOf('A')).isLowerCase();986 * // the remaining code is NOT executed.987 * // ...988 *}</code></pre>989 *990 * @param actual the actual {@link Character} value to be validated.991 * @return the {@link AbstractCharacterAssert} assertion object to be used for assumptions.992 * @since 3.14.0993 */994 public static AbstractCharacterAssert<?> given(Character actual) {995 return assumeThat(actual);996 }997 /**998 * Creates a new assumption's instance for an <code>char</code>s' array.999 * <p>1000 * Examples:1001 * <p>1002 * Executed test:1003 * <pre><code class='java'> {@literal @Test}1004 * public void given_the_assumption_is_met_the_test_is_executed() {1005 * given(new char[] { 'A', 'B' }).contains('A');1006 * // the remaining code is executed1007 * // ...1008 * }</code></pre>1009 * <p>1010 * Skipped test:1011 * <pre><code class='java'> {@literal @Test}1012 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1013 * given(new char[] { 'A', 'B' }).contains('C');1014 * // the remaining code is NOT executed.1015 * // ...1016 *}</code></pre>1017 *1018 * @param actual the actual <code>char</code>s' array to be validated.1019 * @return the {@link AbstractCharacterAssert} assertion object to be used for assumptions.1020 * @since 3.14.01021 */1022 public static AbstractCharArrayAssert<?> given(char[] actual) {1023 return assumeThat(actual);1024 }1025 /**1026 * Creates a new assumption's instance for an <code>char</code>s' two-dimensional array.1027 * <p>1028 * Examples:1029 * <p>1030 * Executed test:1031 * <pre><code class='java'> {@literal @Test}1032 * public void given_the_assumption_is_met_the_test_is_executed() {1033 * given(new char[][] {{'A', 'B'}, {'C', 'D'}}).contains(new char[] {'A', 'B'}, atIndex(0));1034 * // the remaining code is executed1035 * // ...1036 * }</code></pre>1037 * <p>1038 * Skipped test:1039 * <pre><code class='java'> {@literal @Test}1040 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1041 * given(new char[][] {{'A', 'B'}, {'C', 'D'}}).contains(new char[] {'A', 'B'}, atIndex(1));1042 * // the remaining code is NOT executed.1043 * // ...1044 *}</code></pre>1045 *1046 * @param actual the actual <code>char</code>s' two-dimensional array to be validated.1047 * @return the {@link Char2DArrayAssert} assertion object to be used for assumptions.1048 * @since 3.17.01049 */1050 public static Char2DArrayAssert given(char[][] actual) {1051 return assumeThat(actual);1052 }1053 /**1054 * Creates a new assumption's instance for a {@link CharSequence} value.1055 * <p>1056 * Examples:1057 * <p>1058 * Executed test:1059 * <pre><code class='java'> {@literal @Test}1060 * public void given_the_assumption_is_met_the_test_is_executed() {1061 * given((CharSequence) "Yoda").isNotEmpty();1062 * // the remaining code is executed1063 * // ...1064 * }</code></pre>1065 * <p>1066 * Skipped test:1067 * <pre><code class='java'> {@literal @Test}1068 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1069 * given((CharSequence) "Yoda").isNullOrEmpty();1070 * // the remaining code is NOT executed.1071 * // ...1072 *}</code></pre>1073 *1074 * @param actual the actual {@link CharSequence} value to be validated.1075 * @return the {@link AbstractCharSequenceAssert} assertion object to be used for assumptions.1076 * @since 3.14.01077 */1078 public static AbstractCharSequenceAssert<?, ? extends CharSequence> given(CharSequence actual) {1079 return assumeThat(actual);1080 }1081 /**1082 * Creates a new assumption's instance for a {@link String} value.1083 * <p>1084 * Examples:1085 * <p>1086 * Executed test:1087 * <pre><code class='java'> {@literal @Test}1088 * public void given_the_assumption_is_met_the_test_is_executed() {1089 * given("Yoda").isNotEmpty();1090 * // the remaining code is executed1091 * // ...1092 * }</code></pre>1093 * <p>1094 * Skipped test:1095 * <pre><code class='java'> {@literal @Test}1096 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1097 * given("Yoda").isNullOrEmpty();1098 * // the remaining code is NOT executed.1099 * // ...1100 *}</code></pre>1101 *1102 * @param actual the actual {@link String} value to be validated.1103 * @return the {@link AbstractStringAssert} assertion object to be used for assumptions.1104 * @since 3.14.01105 */1106 public static AbstractStringAssert<?> given(String actual) {1107 return assumeThat(actual);1108 }1109 /**1110 * Creates a new assumption's instance for a {@link StringBuilder} value.1111 * <p>1112 * Examples:1113 * <p>1114 * Executed test:1115 * <pre><code class='java'> {@literal @Test}1116 * public void given_the_assumption_is_met_the_test_is_executed() {1117 * given(new StringBuilder("Yoda")).isNotEmpty();1118 * // the remaining code is executed1119 * // ...1120 * }</code></pre>1121 * <p>1122 * Skipped test:1123 * <pre><code class='java'> {@literal @Test}1124 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1125 * given(new StringBuilder("Yoda")).isNullOrEmpty();1126 * // the remaining code is NOT executed.1127 * // ...1128 *}</code></pre>1129 *1130 * @param actual the actual {@link StringBuilder} value to be validated.1131 * @return the {@link AbstractCharSequenceAssert} assertion object to be used for assumptions.1132 * @since 3.14.01133 */1134 public static AbstractCharSequenceAssert<?, ? extends CharSequence> given(StringBuilder actual) {1135 return assumeThat(actual);1136 }1137 /**1138 * Creates a new assumption's instance for a {@link StringBuffer} value.1139 * <p>1140 * Examples:1141 * <p>1142 * Executed test:1143 * <pre><code class='java'> {@literal @Test}1144 * public void given_the_assumption_is_met_the_test_is_executed() {1145 * given(new StringBuffer("Yoda")).isNotEmpty();1146 * // the remaining code is executed1147 * // ...1148 * }</code></pre>1149 * <p>1150 * Skipped test:1151 * <pre><code class='java'> {@literal @Test}1152 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1153 * given(new StringBuffer("Yoda")).isNullOrEmpty();1154 * // the remaining code is NOT executed.1155 * // ...1156 *}</code></pre>1157 *1158 * @param actual the actual {@link StringBuffer} value to be validated.1159 * @return the {@link AbstractCharSequenceAssert} assertion object to be used for assumptions.1160 * @since 3.14.01161 */1162 public static AbstractCharSequenceAssert<?, ? extends CharSequence> given(StringBuffer actual) {1163 return assumeThat(actual);1164 }1165 /**1166 * Creates a new assumption's instance for a {@link Class} value.1167 * <p>1168 * Examples:1169 * <p>1170 * Executed test:1171 * <pre><code class='java'> {@literal @Test}1172 * public void given_the_assumption_is_met_the_test_is_executed() {1173 * given(Number.class).isAssignableFrom(Long.class);1174 * // the remaining code is executed1175 * // ...1176 * }</code></pre>1177 * <p>1178 * Skipped test:1179 * <pre><code class='java'> {@literal @Test}1180 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1181 * given(Number.class).isInterface();1182 * // the remaining code is NOT executed.1183 * // ...1184 *}</code></pre>1185 *1186 * @param actual the actual {@link Class} value to be validated.1187 * @return the {@link AbstractClassAssert} assertion object to be used for assumptions.1188 * @since 3.14.01189 */1190 public static ClassAssert given(Class<?> actual) {1191 return assumeThat(actual);1192 }1193 /**1194 * Creates a new assumption's instance for an object value.1195 * <p>1196 * Examples:1197 * <pre>{@code1198 * TolkienCharacter frodo = new TolkienCharacter("Frodo", 33, HOBBIT);1199 * TolkienCharacter mysteriousHobbit = new TolkienCharacter(null, 33, HOBBIT);1200 * }</pre>1201 * <p>1202 * Executed test:1203 * <pre><code class='java'> {@literal @Test}1204 * public void given_the_assumption_is_met_the_test_is_executed() {1205 * given(frodo).hasNoNullFieldsOrProperties();1206 * // the remaining code is executed1207 * // ...1208 * }</code></pre>1209 * <p>1210 * Skipped test:1211 * <pre><code class='java'> {@literal @Test}1212 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1213 * given(mysteriousHobbit).hasNoNullFieldsOrProperties();1214 * // the remaining code is NOT executed.1215 * // ...1216 *}</code></pre>1217 *1218 * @param <T> the type of the actual object.1219 * @param actual the actual object to be validated.1220 * @return the {@link AbstractObjectAssert} assertion object to be used for assumptions.1221 * @since 3.14.01222 */1223 public static <T> ObjectAssert<T> given(T actual) {1224 return assumeThat(actual);1225 }1226 /**1227 * Creates a new assumption's instance for an objects' array.1228 * <p>1229 * Examples:1230 * <p>1231 * Executed test:1232 * <pre><code class='java'> {@literal @Test}1233 * public void given_the_assumption_is_met_the_test_is_executed() {1234 * given(new String[] { "A", "B" }).hasSizeGreaterThan(1);1235 * // the remaining code is executed1236 * // ...1237 * }</code></pre>1238 * <p>1239 * Skipped test:1240 * <pre><code class='java'> {@literal @Test}1241 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1242 * given(new String[] { "A", "B" }).hasSizeGreaterThan(2);1243 * // the remaining code is NOT executed.1244 * // ...1245 *}</code></pre>1246 *1247 * @param <T> the type of elements of the actual objects' array.1248 * @param actual the actual objects' array to be validated..1249 * @return the {@link AbstractObjectArrayAssert} assertion object to be used for assumptions.1250 * @since 3.14.01251 */1252 public static <T> ObjectArrayAssert<T> given(T[] actual) {1253 return assumeThat(actual);1254 }1255 /**1256 * Creates a new assumption's instance for an objects' two-dimensional array.1257 * <p>1258 * Examples:1259 * <p>1260 * Executed test:1261 * <pre><code class='java'> {@literal @Test}1262 * public void given_the_assumption_is_met_the_test_is_executed() {1263 * given(new String[][] {{"A", "B"}, {"C", "D"}}).contains(new String[] {"A", "B"}, atIndex(0));1264 * // the remaining code is executed1265 * // ...1266 * }</code></pre>1267 * <p>1268 * Skipped test:1269 * <pre><code class='java'> {@literal @Test}1270 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1271 * given(new String[][] {{"A", "B"}, {"C", "D"}}).contains(new String[] {"A", "B"}, atIndex(1));1272 * // the remaining code is NOT executed.1273 * // ...1274 *}</code></pre>1275 *1276 * @param <T> the type of elements of the actual objects' two-dimensional array.1277 * @param actual the actual objects' two-dimensional array to be validated..1278 * @return the {@link Object2DArrayAssert} assertion object to be used for assumptions.1279 * @since 3.17.01280 */1281 public static <T> Object2DArrayAssert<T> given(T[][] actual) {1282 return assumeThat(actual);1283 }1284 /**1285 * Creates a new assumption's instance for an object value.1286 * <p>1287 * This overload is useful, when an overloaded method of given(...) takes precedence over the generic {@link #given(Object) given(T)}, and the assumption requires to access some general assertion methods.1288 * <p>1289 * Example:1290 * <p>1291 * {@link #given(List)} takes precedence over the generic {@link #given(Object) given(T)}1292 * <p>1293 * then when using some base general assert methods, e.g. {@link AbstractAssert#matches(Predicate)}, cast is necessary because {@link #given(List)} "forgets" actual type:1294 * <pre>{@code given(new LinkedList<>(asList("abc"))).matches(list -> ((Deque<String>) list).getFirst().equals("abc")); }</pre>1295 * with <b><code>givenObject</code></b> no cast is needed:1296 * <pre>{@code givenObject(new LinkedList<>(asList("abc"))).matches(list -> list.getFirst().equals("abc")); }</pre>1297 *1298 * @param <T> the type of the actual object.1299 * @param actual the actual object to be validated.1300 * @return the {@link AbstractObjectAssert} assertion object to be used for assumptions.1301 * @since 3.14.01302 */1303 public static <T> ObjectAssert<T> givenObject(T actual) {1304 return assumeThat(actual);1305 }1306 /**1307 * Creates a new assumption's instance for a {@link Comparable} value.1308 * <p>1309 * Examples:1310 * <pre>{@code1311 * class Yoda implements Comparable<Yoda> {1312 * public int compareTo(Yoda to) {1313 * return 0;1314 * }1315 * }1316 * }</pre>1317 * <p>1318 * Executed test:1319 * <pre><code class='java'> {@literal @Test}1320 * public void given_the_assumption_is_met_the_test_is_executed() {1321 * given(new Yoda()).isEqualByComparingTo(new Yoda());1322 * // the remaining code is executed1323 * // ...1324 * }</code></pre>1325 * <p>1326 * Skipped test:1327 * <pre><code class='java'> {@literal @Test}1328 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1329 * given(new Yoda()).isNotEqualByComparingTo(new Yoda());1330 * // the remaining code is NOT executed.1331 * // ...1332 *}</code></pre>1333 *1334 * @param <T> the type of the actual comparable value.1335 * @param actual the actual {@link Comparable} value to be validated.1336 * @return the {@link AbstractComparableAssert} assertion object to be used for assumptions.1337 * @since 3.14.01338 */1339 public static <T extends Comparable<? super T>> AbstractComparableAssert<?, T> given(T actual) {1340 return assumeThat(actual);1341 }1342 /**1343 * Creates a new assumption's instance of a <code>{@link Comparable}</code> value.1344 * <p>1345 * Use this over {@link #given(Comparable)} in case of ambiguous method resolution when the object under test1346 * implements several interfaces Assertj provides <code>given</code> for.1347 *1348 * @param <T> the type of elements.1349 * @param actual the actual value.1350 * @return the created assumption for assertion object.1351 * @since 3.23.01352 */1353 public static <T extends Comparable<? super T>> AbstractComparableAssert<?, T> givenComparable(T actual) {1354 return given(actual);1355 }1356 /**1357 * Creates a new assumption's instance for a {@link Throwable} value.1358 * <p>1359 * Examples:1360 * <p>1361 * Executed test:1362 * <pre><code class='java'> {@literal @Test}1363 * public void given_the_assumption_is_met_the_test_is_executed() {1364 * given(new Exception("Yoda time")).hasMessage("Yoda time");1365 * // the remaining code is executed1366 * // ...1367 * }</code></pre>1368 * <p>1369 * Skipped test:1370 * <pre><code class='java'> {@literal @Test}1371 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1372 * given(new Exception("Yoda time")).hasMessage("");1373 * // the remaining code is NOT executed.1374 * // ...1375 *}</code></pre>1376 *1377 * @param <T> the type of the actual throwable.1378 * @param actual the actual {@link Throwable} value to be validated.1379 * @return the {@link AbstractThrowableAssert} assertion object to be used for assumptions.1380 * @since 3.14.01381 */1382 public static <T extends Throwable> AbstractThrowableAssert<?, T> given(T actual) {1383 return assumeThat(actual);1384 }1385 /**1386 * Creates a new assumption's instance for a {@link Throwable} value.1387 *1388 * @param <T> the exception type.1389 * @param exceptionType the exception type class.1390 * @return the created {@link ThrowableTypeAssert}.1391 * @since 3.23.01392 */1393 public static <T extends Throwable> ThrowableTypeAssert<T> givenExceptionOfType(final Class<? extends T> exceptionType) {1394 return assumeThatExceptionOfType(exceptionType);1395 }1396 /**1397 * Alias for {@link #givenExceptionOfType(Class)} for {@link Exception}.1398 *1399 * @return the {@link ThrowableAssert} assertion object to be used for assumptions.1400 * @since 3.23.01401 */1402 public static ThrowableTypeAssert<Exception> givenException() {1403 return assumeThatException();1404 }1405 /**1406 * Alias for {@link #givenExceptionOfType(Class)} for {@link RuntimeException}.1407 *1408 * @return the {@link ThrowableAssert} assertion object to be used for assumptions.1409 * @since 3.23.01410 */1411 public static ThrowableTypeAssert<RuntimeException> givenRuntimeException() {1412 return assumeThatRuntimeException();1413 }1414 /**1415 * Alias for {@link #givenExceptionOfType(Class)} for {@link NullPointerException}.1416 *1417 * @return the {@link ThrowableAssert} assertion object to be used for assumptions.1418 *1419 * @since 3.23.01420 */1421 public static ThrowableTypeAssert<NullPointerException> givenNullPointerException() {1422 return assumeThatNullPointerException();1423 }1424 /**1425 * Alias for {@link #givenExceptionOfType(Class)} for {@link IllegalArgumentException}.1426 *1427 * @return the {@link ThrowableAssert} assertion object to be used for assumptions.1428 * @since 3.23.01429 */1430 public static ThrowableTypeAssert<IllegalArgumentException> givenIllegalArgumentException() {1431 return assumeThatIllegalArgumentException();1432 }1433 /**1434 * Alias for {@link #givenExceptionOfType(Class)} for {@link IOException}.1435 *1436 * @return the {@link ThrowableAssert} assertion object to be used for assumptions.1437 * @since 3.23.01438 */1439 public static ThrowableTypeAssert<IOException> givenIOException() {1440 return assumeThatIOException();1441 }1442 /**1443 * Alias for {@link #givenExceptionOfType(Class)} for {@link IndexOutOfBoundsException}.1444 *1445 * @return the {@link ThrowableAssert} assertion object to be used for assumptions.1446 * @since 3.23.01447 */1448 public static ThrowableTypeAssert<IndexOutOfBoundsException> givenIndexOutOfBoundsException() {1449 return assumeThatIndexOutOfBoundsException();1450 }1451 /**1452 * Alias for {@link #givenExceptionOfType(Class)} for {@link ReflectiveOperationException}.1453 *1454 * @return the {@link ThrowableAssert} assertion object to be used for assumptions.1455 * @since 3.23.01456 */1457 public static ThrowableTypeAssert<ReflectiveOperationException> givenReflectiveOperationException() {1458 return assumeThatReflectiveOperationException();1459 }1460 /**1461 * Creates a new assumption's instance from a no parameters lambda expression, <code>{@literal () ->} { /* some code {@literal *}/ }</code>.1462 * <p>1463 * Examples:1464 * <p>1465 * <u>No Exception required</u>:1466 * <p>1467 * Executed test:1468 * <pre><code class='java'> {@literal @Test}1469 * public void given_the_assumption_is_met_the_test_is_executed() {1470 * {@literal givenCode(() ->} {{@literal /* some code *}/ }).doesNotThrowAnyException();1471 * // the remaining code is executed1472 * // ...1473 * }</code></pre>1474 * <p>1475 * Skipped test:1476 * <pre><code class='java'> {@literal @Test}1477 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1478 * {@literal givenCode(() ->} {{@literal /* some code *}/ }).hasMessage("Yoda time");1479 * // the remaining code is NOT executed.1480 * // ...1481 *}</code></pre>1482 * <p>1483 * <u>Exception required</u>:1484 * <p>1485 * Executed test:1486 * <pre><code class='java'> {@literal @Test}1487 * public void given_the_assumption_is_met_the_test_is_executed() {1488 * {@literal givenCode(() -> {throw new Exception("Yoda time");}).hasMessage("Yoda time");1489 * // the remaining code is executed1490 * // ...1491 * }</code></pre>1492 * <p>1493 * Skipped test:1494 * <pre><code class='java'> {@literal @Test}1495 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1496 * {@literal givenCode(() -> {throw new Exception("Yoda time");}).doesNotThrowAnyException();1497 * // the remaining code is NOT executed.1498 * // ...1499 *}</code></pre>1500 *1501 * @param lambda the {@link ThrowingCallable} or lambda with the code that may raise a throwable to be validated.1502 * @return the {@link AbstractThrowableAssert} assertion object to be used for assumptions.1503 * @since 3.14.01504 */1505 public static AbstractThrowableAssert<?, ? extends Throwable> givenCode(ThrowingCallable lambda) {1506 return assumeThatCode(lambda);1507 }1508 /**1509 * Creates a new assumption's instance for an {@link Iterable} value.1510 * <p>1511 * Examples:1512 * <p>1513 * Executed test:1514 * <pre><code class='java'> {@literal @Test}1515 * public void given_the_assumption_is_met_the_test_is_executed() {1516 * {@literal given((Iterable<Integer>)(Arrays.asList(1, 2))).contains(2);}1517 * // the remaining code is executed1518 * // ...1519 * }</code></pre>1520 * <p>1521 * Skipped test:1522 * <pre><code class='java'> {@literal @Test}1523 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1524 * {@literal given((Iterable<Integer>)(Arrays.asList(1, 2))).containsOnly(2);}1525 * // the remaining code is NOT executed.1526 * // ...1527 *}</code></pre>1528 *1529 * @param <ELEMENT> the type of elements of actual iterable value.1530 * @param actual the actual {@link Iterable} value to be validated.1531 * @return the {@link AbstractIterableAssert} assertion object to be used for assumptions.1532 * @since 3.14.01533 */1534 public static <ELEMENT> IterableAssert<ELEMENT> given(Iterable<? extends ELEMENT> actual) {1535 return assumeThat(actual);1536 }1537 /**1538 * Creates a new assumption's instance of an <code>{@link Iterable}</code> value.1539 * <p>1540 * Use this over {@link #given(Iterable)} in case of ambiguous method resolution when the object under test1541 * implements several interfaces Assertj provides <code>given</code> for.1542 *1543 * @param <ELEMENT> the type of elements of actual iterable value.1544 * @param actual the actual {@link Iterable} value to be validated.1545 * @return the {@link AbstractIterableAssert} assertion object to be used for assumptions.1546 * @since 3.23.01547 */1548 public static <ELEMENT> IterableAssert<ELEMENT> givenIterable(Iterable<? extends ELEMENT> actual) {1549 return given(actual);1550 }1551 /**1552 * Creates a new assumption's instance for an {@link Iterator} value.1553 * <p>1554 * Examples:1555 * <p>1556 * Executed test:1557 * <pre><code class='java'> {@literal @Test}1558 * public void given_the_assumption_is_met_the_test_is_executed() {1559 * given(Arrays.asList(1, 2).iterator()).hasNext();1560 * // the remaining code is executed1561 * // ...1562 * }</code></pre>1563 * <p>1564 * Skipped test:1565 * <pre><code class='java'> {@literal @Test}1566 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1567 * given(Arrays.asList(1, 2).iterator()).isExhausted();1568 * // the remaining code is NOT executed.1569 * // ...1570 *}</code></pre>1571 *1572 * @param <ELEMENT> the type of elements of actual iterator value.1573 * @param actual the actual {@link Iterator} value to be validated.1574 * @return the {@link AbstractIteratorAssert} assertion object to be used for assumptions.1575 * @since 3.14.01576 */1577 public static <ELEMENT> IteratorAssert<ELEMENT> given(Iterator<? extends ELEMENT> actual) {1578 return assumeThat(actual);1579 }1580 /**1581 * Creates a new assumption's instance of an <code>{@link Iterator}</code> value.1582 * <p>1583 * Use this over {@link #given(Iterator)} in case of ambiguous method resolution when the object under test1584 * implements several interfaces Assertj provides <code>given</code> for.1585 *1586 * @param <ELEMENT> the type of elements of actual iterable value.1587 * @param actual the actual {@link Iterator} value to be validated.1588 * @return the {@link AbstractIteratorAssert} assertion object to be used for assumptions.1589 * @since 3.23.01590 */1591 public static <ELEMENT> IteratorAssert<ELEMENT> givenIterator(Iterator<? extends ELEMENT> actual) {1592 return given(actual);1593 }1594 /**1595 * Creates a new assumption's instance for a {@link Collection} value.1596 *1597 * @param <E> the type of elements.1598 * @param actual the actual value.1599 * @return the created assumption for assertion object.1600 * @see Assumptions#assumeThat(Collection)1601 * @since 3.21.01602 */1603 public static <E> AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>> given(Collection<? extends E> actual) {1604 return assumeThat(actual);1605 }1606 /**1607 * Creates a new assumption's instance of a <code>{@link Collection}</code> value.1608 * <p>1609 * Use this over {@link #given(Collection)} in case of ambiguous method resolution when the object under test1610 * implements several interfaces Assertj provides <code>given</code> for.1611 *1612 * @param <E> the type of elements.1613 * @param actual the actual value.1614 * @return the created assumption for assertion object.1615 * @since 3.23.01616 */1617 public static <E> AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>> givenCollection(Collection<? extends E> actual) {1618 return given(actual);1619 }1620 /**1621 * Creates a new assumption's instance for a {@link List} value.1622 * <p>1623 * Examples:1624 * <p>1625 * Executed test:1626 * <pre><code class='java'> {@literal @Test}1627 * public void given_the_assumption_is_met_the_test_is_executed() {1628 * given(Arrays.asList(1, 2)).contains(2);1629 * // the remaining code is executed1630 * // ...1631 * }</code></pre>1632 * <p>1633 * Skipped test:1634 * <pre><code class='java'> {@literal @Test}1635 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1636 * given(Arrays.asList(1, 2)).containsOnly(2);1637 * // the remaining code is NOT executed.1638 * // ...1639 *}</code></pre>1640 *1641 * @param <ELEMENT> the type of elements of actual list value.1642 * @param actual the actual {@link List} value to be validated.1643 * @return the {@link AbstractListAssert} assertion object to be used for assumptions.1644 * @since 3.14.01645 */1646 public static <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> given(List<? extends ELEMENT> actual) {1647 return assumeThat(actual);1648 }1649 /**1650 * Creates a new assumption's instance of a <code>{@link List}</code> value.1651 * <p>1652 * Use this over {@link #given(List)} in case of ambiguous method resolution when the object under test1653 * implements several interfaces Assertj provides <code>given</code> for.1654 *1655 * @param <ELEMENT> the type of elements.1656 * @param actual the actual value.1657 * @return the {@link AbstractListAssert} assertion object to be used for assumptions.1658 * @since 3.23.01659 */1660 public static <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> givenList(List<? extends ELEMENT> actual) {1661 return given(actual);1662 }1663 /**1664 * Creates a new assumption's instance for a {@link Map} value.1665 * <p>1666 * Examples:1667 * <p>1668 * Executed test:1669 * <pre><code class='java'> {@literal @Test}1670 * public void given_the_assumption_is_met_the_test_is_executed() {1671 * given(Collections.singletonMap(1, 2)).containsEntry(1, 2);1672 * // the remaining code is executed1673 * // ...1674 * }</code></pre>1675 * <p>1676 * Skipped test:1677 * <pre><code class='java'> {@literal @Test}1678 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1679 * given(Collections.singletonMap(1, 2)).containsEntry(2, 1);1680 * // the remaining code is NOT executed.1681 * // ...1682 *}</code></pre>1683 *1684 * @param <K> the type of keys in the actual map value.1685 * @param <V> the type of values in the actual map value.1686 * @param actual the actual {@link Map} value to be validated.1687 * @return the {@link AbstractMapAssert} assertion object to be used for assumptions.1688 * @since 3.14.01689 */1690 public static <K, V> MapAssert<K, V> given(Map<K, V> actual) {1691 return assumeThat(actual);1692 }1693 /**1694 * Creates a new assumption's instance for a {@link Predicate} value.1695 * <p>1696 * Examples:1697 * <p>1698 * Executed test:1699 * <pre><code class='java'> {@literal @Test}1700 * public void given_the_assumption_is_met_the_test_is_executed() {1701 * {@literal given((Predicate<Integer>)(value -> value > 0)).accepts(1, 2);}1702 * // the remaining code is executed1703 * // ...1704 * }</code></pre>1705 * <p>1706 * Skipped test:1707 * <pre><code class='java'> {@literal @Test}1708 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1709 * {@literal given((Predicate<Integer>)(value -> value > 0)).accepts(-2, -1);}1710 * // the remaining code is NOT executed.1711 * // ...1712 *}</code></pre>1713 *1714 * @param <T> the type of the value contained in the actual predicate value.1715 * @param actual the actual {@link Predicate} value to be validated.1716 * @return the {@link AbstractPredicateAssert} assertion object to be used for assumptions.1717 * @since 3.14.01718 */1719 public static <T> PredicateAssert<T> given(Predicate<T> actual) {1720 return assumeThat(actual);1721 }1722 /**1723 * Creates a new assumption's instance of a <code>{@link Predicate}</code> value.1724 * <p>1725 * Use this over {@link #given(Predicate)} in case of ambiguous method resolution when the object under test1726 * implements several interfaces Assertj provides <code>given</code> for.1727 *1728 * @param <T> the type of elements.1729 * @param actual the actual value.1730 * @return the {@link AbstractPredicateAssert} assertion object to be used for assumptions.1731 * @since 3.23.01732 */1733 public static <T> PredicateAssert<T> givenPredicate(Predicate<T> actual) {1734 return given(actual);1735 }1736 /**1737 * Creates a new assumption's instance for an {@link IntPredicate} value.1738 * <p>1739 * Examples:1740 * <p>1741 * Executed test:1742 * <pre><code class='java'> {@literal @Test}1743 * public void given_the_assumption_is_met_the_test_is_executed() {1744 * {@literal given((IntPredicate)(value -> value > 0)).accepts(1, 2);}1745 * // the remaining code is executed1746 * // ...1747 * }</code></pre>1748 * <p>1749 * Skipped test:1750 * <pre><code class='java'> {@literal @Test}1751 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1752 * {@literal given((IntPredicate)(value -> value > 0)).accepts(-2, -1);}1753 * // the remaining code is NOT executed.1754 * // ...1755 *}</code></pre>1756 *1757 * @param actual the actual {@link IntPredicate} value to be validated.1758 * @return the {@link IntPredicateAssert} assertion object to be used for assumptions.1759 * @since 3.14.01760 */1761 public static IntPredicateAssert given(IntPredicate actual) {1762 return assumeThat(actual);1763 }1764 /**1765 * Creates a new assumption's instance for a {@link LongPredicate} value.1766 * <p>1767 * Examples:1768 * <p>1769 * Executed test:1770 * <pre><code class='java'> {@literal @Test}1771 * public void given_the_assumption_is_met_the_test_is_executed() {1772 * {@literal given((LongPredicate)(value -> value > 0)).accepts(1, 2);}1773 * // the remaining code is executed1774 * // ...1775 * }</code></pre>1776 * <p>1777 * Skipped test:1778 * <pre><code class='java'> {@literal @Test}1779 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1780 * {@literal given((LongPredicate)(value -> value > 0)).accepts(-2, -1);}1781 * // the remaining code is NOT executed.1782 * // ...1783 *}</code></pre>1784 *1785 * @param actual the actual {@link LongPredicate} value to be validated.1786 * @return the {@link LongPredicateAssert} assertion object to be used for assumptions.1787 * @since 3.14.01788 */1789 public static LongPredicateAssert given(LongPredicate actual) {1790 return assumeThat(actual);1791 }1792 /**1793 * Creates a new assumption's instance for a {@link DoublePredicate} value.1794 * <p>1795 * Examples:1796 * <p>1797 * Executed test:1798 * <pre><code class='java'> {@literal @Test}1799 * public void given_the_assumption_is_met_the_test_is_executed() {1800 * {@literal given((DoublePredicate)(value -> value > 0)).accepts(1.0, 2.0);}1801 * // the remaining code is executed1802 * // ...1803 * }</code></pre>1804 * <p>1805 * Skipped test:1806 * <pre><code class='java'> {@literal @Test}1807 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1808 * {@literal given((DoublePredicate)(value -> value > 0)).accepts(-2.0, -1.0);}1809 * // the remaining code is NOT executed.1810 * // ...1811 *}</code></pre>1812 *1813 * @param actual the actual {@link DoublePredicate} value to be validated.1814 * @return the {@link DoublePredicateAssert} assertion object to be used for assumptions.1815 * @since 3.14.01816 */1817 public static DoublePredicateAssert given(DoublePredicate actual) {1818 return assumeThat(actual);1819 }1820 /**1821 * Creates a new assumption's instance for an {@link Optional} value.1822 * <p>1823 * Examples:1824 * <p>1825 * Executed test:1826 * <pre><code class='java'> {@literal @Test}1827 * public void given_the_assumption_is_met_the_test_is_executed() {1828 * given(Optional.empty()).isEmpty();1829 * // the remaining code is executed1830 * // ...1831 * }</code></pre>1832 * <p>1833 * Skipped test:1834 * <pre><code class='java'> {@literal @Test}1835 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1836 * given(Optional.empty()).isNotEmpty();1837 * // the remaining code is NOT executed.1838 * // ...1839 *}</code></pre>1840 *1841 * @param <VALUE> the type of the value contained in the actual optional value.1842 * @param actual the actual {@link Optional} value to be validated.1843 * @return the {@link OptionalAssert} assertion object to be used for assumptions.1844 * @since 3.14.01845 */1846 public static <VALUE> OptionalAssert<VALUE> given(Optional<VALUE> actual) {1847 return assumeThat(actual);1848 }1849 /**1850 * Creates a new assumption's instance for an {@link OptionalInt} value.1851 * <p>1852 * Examples:1853 * <p>1854 * Executed test:1855 * <pre><code class='java'> {@literal @Test}1856 * public void given_the_assumption_is_met_the_test_is_executed() {1857 * given(OptionalInt.empty()).isEmpty();1858 * // the remaining code is executed1859 * // ...1860 * }</code></pre>1861 * <p>1862 * Skipped test:1863 * <pre><code class='java'> {@literal @Test}1864 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1865 * given(OptionalInt.empty()).isNotEmpty();1866 * // the remaining code is NOT executed.1867 * // ...1868 *}</code></pre>1869 *1870 * @param actual the actual {@link OptionalInt} value to be validated.1871 * @return the {@link OptionalIntAssert} assertion object to be used for assumptions.1872 * @since 3.14.01873 */1874 public static OptionalIntAssert given(OptionalInt actual) {1875 return assumeThat(actual);1876 }1877 /**1878 * Creates a new assumption's instance for an {@link Matcher}.1879 * <p>1880 *1881 * @param actual the actual {@link Matcher} value to be validated.1882 * @return the {@link Matcher} assertion object to be used for assumptions.1883 */1884 public static MatcherAssert given(Matcher actual) {1885 return assumeThat(actual);1886 }1887 /**1888 * Creates a new assumption's instance for an {@link OptionalLong} value.1889 * <p>1890 * Examples:1891 * <p>1892 * Executed test:1893 * <pre><code class='java'> {@literal @Test}1894 * public void given_the_assumption_is_met_the_test_is_executed() {1895 * given(OptionalLong.empty()).isEmpty();1896 * // the remaining code is executed1897 * // ...1898 * }</code></pre>1899 * <p>1900 * Skipped test:1901 * <pre><code class='java'> {@literal @Test}1902 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1903 * given(OptionalLong.empty()).isNotEmpty();1904 * // the remaining code is NOT executed.1905 * // ...1906 *}</code></pre>1907 *1908 * @param actual the actual {@link OptionalLong} value to be validated.1909 * @return the {@link OptionalLongAssert} assertion object to be used for assumptions.1910 * @since 3.14.01911 */1912 public static OptionalLongAssert given(OptionalLong actual) {1913 return assumeThat(actual);1914 }1915 /**1916 * Creates a new assumption's instance for an {@link OptionalDouble} value.1917 * <p>1918 * Examples:1919 * <p>1920 * Executed test:1921 * <pre><code class='java'> {@literal @Test}1922 * public void given_the_assumption_is_met_the_test_is_executed() {1923 * given(OptionalDouble.empty()).isEmpty();1924 * // the remaining code is executed1925 * // ...1926 * }</code></pre>1927 * <p>1928 * Skipped test:1929 * <pre><code class='java'> {@literal @Test}1930 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1931 * given(OptionalDouble.empty()).isNotEmpty();1932 * // the remaining code is NOT executed.1933 * // ...1934 *}</code></pre>1935 *1936 * @param actual the actual {@link OptionalDouble} value to be validated.1937 * @return the {@link OptionalDoubleAssert} assertion object to be used for assumptions.1938 * @since 3.14.01939 */1940 public static OptionalDoubleAssert given(OptionalDouble actual) {1941 return assumeThat(actual);1942 }1943 /**1944 * Creates a new assumption's instance for a {@link Stream} value.1945 * <p>1946 * Examples:1947 * <p>1948 * Executed test:1949 * <pre><code class='java'> {@literal @Test}1950 * public void given_the_assumption_is_met_the_test_is_executed() {1951 * given(Stream.of(1, 2)).contains(2);1952 * // the remaining code is executed1953 * // ...1954 * }</code></pre>1955 * <p>1956 * Skipped test:1957 * <pre><code class='java'> {@literal @Test}1958 * public void given_the_assumption_is_not_met_the_test_is_skipped() {1959 * given(Stream.of(1, 2)).containsOnly(2);1960 * // the remaining code is NOT executed.1961 * // ...1962 *}</code></pre>1963 *1964 * @param <ELEMENT> the type of the value contained in the actual stream value.1965 * @param actual the actual {@link Stream} value to be validated.1966 * @return the {@link AbstractListAssert} assertion object to be used for assumptions.1967 * @since 3.14.01968 */1969 public static <ELEMENT> AbstractListAssert<?, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> given(Stream<? extends ELEMENT> actual) {1970 return assumeThat(actual);1971 }1972 /**1973 * Creates a new assumption's instance of a <code>{@link Stream}</code> value.1974 * <p>1975 * Use this over {@link #given(Stream)} in case of ambiguous method resolution when the object under test1976 * implements several interfaces Assertj provides <code>given</code> for.1977 *1978 * @param <ELEMENT> the type of elements.1979 * @param actual the actual {@link Stream} value to be validated.1980 * @return the {@link AbstractListAssert} assertion object to be used for assumptions.1981 * @since 3.23.01982 */1983 public static <ELEMENT> AbstractListAssert<?, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> givenStream(Stream<? extends ELEMENT> actual) {1984 return given(actual);1985 }1986 /**1987 * Creates a new assumption's instance for an {@link IntStream} value.1988 * <p>1989 * Examples:1990 * <p>1991 * Executed test:1992 * <pre><code class='java'> {@literal @Test}1993 * public void given_the_assumption_is_met_the_test_is_executed() {1994 * given(IntStream.of(1, 2)).contains(2);1995 * // the remaining code is executed1996 * // ...1997 * }</code></pre>1998 * <p>1999 * Skipped test:2000 * <pre><code class='java'> {@literal @Test}2001 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2002 * given(IntStream.of(1, 2)).containsOnly(2);2003 * // the remaining code is NOT executed.2004 * // ...2005 *}</code></pre>2006 *2007 * @param actual the actual {@link IntStream} value to be validated.2008 * @return the {@link AbstractListAssert} assertion object to be used for assumptions.2009 * @since 3.14.02010 */2011 public static AbstractListAssert<?, List<? extends Integer>, Integer, ObjectAssert<Integer>> given(IntStream actual) {2012 return assumeThat(actual);2013 }2014 /**2015 * Creates a new assumption's instance for a {@link Spliterator} value.2016 * <p>2017 * Examples:2018 * <p>2019 * Executed test:2020 * <pre><code class='java'> {@literal @Test}2021 * public void given_the_assumption_is_met_the_test_is_executed() {2022 * given(Stream.of(1, 2).spliterator()).hasCharacteristics(Spliterator.SIZED)2023 * // the remaining code is executed2024 * ...2025 * }</code></pre>2026 * <p>2027 * Skipped test:2028 * <pre><code class='java'> {@literal @Test}2029 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2030 * given(Stream.of(1, 2).spliterator()).hasCharacteristics(Spliterator.DISTINCT)2031 * // the remaining code is NOT executed.2032 * }</code></pre>2033 *2034 * @param <ELEMENT> the type of the elements2035 * @param actual the actual {@link Spliterator} value to be validated.2036 * @return the {@link AbstractSpliteratorAssert} assertion object to be used for assumptions.2037 * @since 3.14.02038 */2039 public static <ELEMENT> AbstractSpliteratorAssert<?, ELEMENT> given(Spliterator<ELEMENT> actual) {2040 return assumeThat(actual);2041 }2042 /**2043 * Creates a new assumption's instance for a {@link LongStream} value.2044 * <p>2045 * Examples:2046 * <p>2047 * Executed test:2048 * <pre><code class='java'> {@literal @Test}2049 * public void given_the_assumption_is_met_the_test_is_executed() {2050 * given(LongStream.of(1, 2)).contains(2);2051 * // the remaining code is executed2052 * // ...2053 * }</code></pre>2054 * <p>2055 * Skipped test:2056 * <pre><code class='java'> {@literal @Test}2057 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2058 * given(LongStream.of(1, 2)).containsOnly(2);2059 * // the remaining code is NOT executed.2060 * // ...2061 *}</code></pre>2062 *2063 * @param actual the actual {@link LongStream} value to be validated.2064 * @return the {@link AbstractListAssert} assertion object to be used for assumptions.2065 * @since 3.14.02066 */2067 public static AbstractListAssert<?, List<? extends Long>, Long, ObjectAssert<Long>> given(LongStream actual) {2068 return assumeThat(actual);2069 }2070 /**2071 * Creates a new assumption's instance for a {@link DoubleStream} value.2072 * <p>2073 * Examples:2074 * <p>2075 * Executed test:2076 * <pre><code class='java'> {@literal @Test}2077 * public void given_the_assumption_is_met_the_test_is_executed() {2078 * given(DoubleStream.of(1.0, 2.0)).contains(2.0);2079 * // the remaining code is executed2080 * // ...2081 * }</code></pre>2082 * <p>2083 * Skipped test:2084 * <pre><code class='java'> {@literal @Test}2085 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2086 * given(DoubleStream.of(1.0, 2.0)).containsOnly(2.0);2087 * // the remaining code is NOT executed.2088 * // ...2089 *}</code></pre>2090 *2091 * @param actual the actual {@link DoubleStream} value to be validated.2092 * @return the {@link AbstractListAssert} assertion object to be used for assumptions.2093 * @since 3.14.02094 */2095 public static AbstractListAssert<?, List<? extends Double>, Double, ObjectAssert<Double>> given(DoubleStream actual) {2096 return assumeThat(actual);2097 }2098 /**2099 * Creates a new assumption's instance for a {@link Future} value.2100 * <p>2101 * Examples:2102 * <p>2103 * Executed test:2104 * <pre><code class='java'> {@literal @Test}2105 * public void given_the_assumption_is_met_the_test_is_executed() {2106 * {@literal given(Executors.newSingleThreadExecutor().submit(() -> {})).isNotCancelled();}2107 * // the remaining code is executed2108 * // ...2109 * }</code></pre>2110 * <p>2111 * Skipped test:2112 * <pre><code class='java'> {@literal @Test}2113 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2114 * {@literal given(Executors.newSingleThreadExecutor().submit(() -> {})).isCancelled();}2115 * // the remaining code is NOT executed.2116 * // ...2117 *}</code></pre>2118 *2119 * @param <RESULT> the type of the value contained in the actual future value.2120 * @param future the {@link Future} value to be validated.2121 * @return the {@link AbstractFutureAssert} assertion object to be used for assumptions.2122 * @since 3.14.02123 */2124 public static <RESULT> AbstractFutureAssert<?, ? extends Future<? extends RESULT>, RESULT> given(Future<RESULT> future) {2125 return assumeThat(future);2126 }2127 /**2128 * Creates a new assumption's instance for a {@link CompletableFuture} value.2129 * <p>2130 * Examples:2131 * <p>2132 * Executed test:2133 * <pre><code class='java'> {@literal @Test}2134 * public void given_the_assumption_is_met_the_test_is_executed() {2135 * given(CompletableFuture.completedFuture​(1)).isDone();2136 * // the remaining code is executed2137 * // ...2138 * }</code></pre>2139 * <p>2140 * Skipped test:2141 * <pre><code class='java'> {@literal @Test}2142 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2143 * given(CompletableFuture.completedFuture​(1)).isNotDone();2144 * // the remaining code is NOT executed.2145 * // ...2146 *}</code></pre>2147 *2148 * @param <RESULT> the type of the value contained in the actual future value.2149 * @param future the {@link CompletableFuture} value to be validated.2150 * @return the {@link AbstractCompletableFutureAssert} assertion object to be used for assumptions.2151 * @since 3.14.02152 */2153 public static <RESULT> CompletableFutureAssert<RESULT> given(CompletableFuture<RESULT> future) {2154 return assumeThat(future);2155 }2156 /**2157 * Creates a new assumption's instance for a {@link CompletionStage} value.2158 * <p>2159 * Converts the {@link CompletionStage} into a {@link CompletableFuture}.2160 * If the given {@link CompletionStage} is null, the associated {@link CompletableFuture} will also be null.2161 * <p>2162 * Examples:2163 * <p>2164 * Executed test:2165 * <pre><code class='java'> {@literal @Test}2166 * public void given_the_assumption_is_met_the_test_is_executed() {2167 * {@literal given((CompletionStage<Integer>) CompletableFuture.completedFuture​(1)).isDone();}2168 * // the remaining code is executed2169 * // ...2170 * }</code></pre>2171 * <p>2172 * Skipped test:2173 * <pre><code class='java'> {@literal @Test}2174 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2175 * {@literal given((CompletionStage<Integer>) CompletableFuture.completedFuture​(1)).isNotDone();}2176 * // the remaining code is NOT executed.2177 * // ...2178 *}</code></pre>2179 *2180 * @param <RESULT> the type of the value contained in the actual future value.2181 * @param stage the {@link CompletionStage} value to be validated.2182 * @return the {@link AbstractCompletableFutureAssert} assertion object to be used for assumptions.2183 * @since 3.14.02184 */2185 public static <RESULT> CompletableFutureAssert<RESULT> given(CompletionStage<RESULT> stage) {2186 return assumeThat(stage);2187 }2188 /**2189 * Creates a new assumption's instance for an {@link AtomicBoolean} value.2190 * <p>2191 * Examples:2192 * <p>2193 * Executed test:2194 * <pre><code class='java'> {@literal @Test}2195 * public void given_the_assumption_is_met_the_test_is_executed() {2196 * given(new AtomicBoolean(true)).isTrue();2197 * // the remaining code is executed2198 * // ...2199 * }</code></pre>2200 * <p>2201 * Skipped test:2202 * <pre><code class='java'> {@literal @Test}2203 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2204 * given(new AtomicBoolean(true)).isFalse();2205 * // the remaining code is NOT executed.2206 * // ...2207 *}</code></pre>2208 *2209 * @param actual the actual {@link AtomicBoolean} value to be validated.2210 * @return the {@link AtomicBooleanAssert} assertion object to be used for assumptions.2211 * @since 3.14.02212 */2213 public static AtomicBooleanAssert given(AtomicBoolean actual) {2214 return assumeThat(actual);2215 }2216 /**2217 * Creates a new assumption's instance for an {@link AtomicInteger} value.2218 * <p>2219 * Examples:2220 * <p>2221 * Executed test:2222 * <pre><code class='java'> {@literal @Test}2223 * public void given_the_assumption_is_met_the_test_is_executed() {2224 * given(new AtomicInteger(1)).hasNonNegativeValue();2225 * // the remaining code is executed2226 * // ...2227 * }</code></pre>2228 * <p>2229 * Skipped test:2230 * <pre><code class='java'> {@literal @Test}2231 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2232 * given(new AtomicInteger(1)).hasNegativeValue();2233 * // the remaining code is NOT executed.2234 * // ...2235 *}</code></pre>2236 *2237 * @param actual the actual {@link AtomicInteger} value to be validated.2238 * @return the {@link AtomicIntegerAssert} assertion object to be used for assumptions.2239 * @since 3.14.02240 */2241 public static AtomicIntegerAssert given(AtomicInteger actual) {2242 return assumeThat(actual);2243 }2244 /**2245 * Creates a new assumption's instance for an {@link AtomicIntegerArray} value.2246 * <p>2247 * Examples:2248 * <p>2249 * Executed test:2250 * <pre><code class='java'> {@literal @Test}2251 * public void given_the_assumption_is_met_the_test_is_executed() {2252 * given(new AtomicIntegerArray(0)).isEmpty();2253 * // the remaining code is executed2254 * // ...2255 * }</code></pre>2256 * <p>2257 * Skipped test:2258 * <pre><code class='java'> {@literal @Test}2259 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2260 * given(new AtomicIntegerArray(0)).isNotEmpty();2261 * // the remaining code is NOT executed.2262 * // ...2263 *}</code></pre>2264 *2265 * @param actual the actual {@link AtomicIntegerArray} value to be validated.2266 * @return the {@link AtomicIntegerArrayAssert} assertion object to be used for assumptions.2267 * @since 3.14.02268 */2269 public static AtomicIntegerArrayAssert given(AtomicIntegerArray actual) {2270 return assumeThat(actual);2271 }2272 /**2273 * Creates a new assumption's instance for an {@link AtomicIntegerFieldUpdater} value.2274 * <p>2275 * Examples:2276 * <pre>{@code2277 * class Yoda {2278 * public volatile int field = 0;2279 * }2280 * }</pre>2281 * <pre>{@code2282 * AtomicIntegerFieldUpdater actual = AtomicIntegerFieldUpdater.newUpdater​(Yoda.class, "field");2283 * Yoda value = new Yoda();2284 * actual.set(value, 1);2285 * }</pre>2286 * <p>2287 * Executed test:2288 * <pre><code class='java'> {@literal @Test}2289 * public void given_the_assumption_is_met_the_test_is_executed() {2290 * given(actual).hasValue(1, value);2291 * // the remaining code is executed2292 * // ...2293 * }</code></pre>2294 * <p>2295 * Skipped test:2296 * <pre><code class='java'> {@literal @Test}2297 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2298 * given(actual).hasValue(2, value));2299 * // the remaining code is NOT executed.2300 * // ...2301 *}</code></pre>2302 *2303 * @param <OBJECT> the type of the object holding the updatable field which gets updated by the the actual value.2304 * @param actual the actual {@link AtomicIntegerFieldUpdater} value to be validated.2305 * @return the {@link AtomicIntegerFieldUpdaterAssert} assertion object to be used for assumptions.2306 * @since 3.14.02307 */2308 public static <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> given(AtomicIntegerFieldUpdater<OBJECT> actual) {2309 return assumeThat(actual);2310 }2311 /**2312 * Creates a new assumption's instance for a {@link LongAdder} value.2313 * <p>2314 * Examples:2315 * <p>2316 * Executed test:2317 * <pre><code class='java'> {@literal @Test}2318 * public void given_the_assumption_is_met_the_test_is_executed() {2319 * given(new LongAdder()).isNotNegative();2320 * // the remaining code is executed2321 * // ...2322 * }</code></pre>2323 * <p>2324 * Skipped test:2325 * <pre><code class='java'> {@literal @Test}2326 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2327 * given(new LongAdder()).isNegative();2328 * // the remaining code is NOT executed.2329 * // ...2330 *}</code></pre>2331 *2332 * @param actual the actual {@link LongAdder} value to be validated.2333 * @return the {@link LongAdderAssert} assertion object to be used for assumptions.2334 * @since 3.16.02335 */2336 public static LongAdderAssert given(LongAdder actual) {2337 return assumeThat(actual);2338 }2339 /**2340 * Creates a new assumption's instance for an {@link AtomicLong} value.2341 * <p>2342 * Examples:2343 * <p>2344 * Executed test:2345 * <pre><code class='java'> {@literal @Test}2346 * public void given_the_assumption_is_met_the_test_is_executed() {2347 * given(new AtomicLong(1L)).hasNonNegativeValue();2348 * // the remaining code is executed2349 * // ...2350 * }</code></pre>2351 * <p>2352 * Skipped test:2353 * <pre><code class='java'> {@literal @Test}2354 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2355 * given(new AtomicLong(1L)).hasNegativeValue();2356 * // the remaining code is NOT executed.2357 * // ...2358 *}</code></pre>2359 *2360 * @param actual the actual {@link AtomicLong} value to be validated.2361 * @return the {@link AtomicLongAssert} assertion object to be used for assumptions.2362 * @since 3.14.02363 */2364 public static AtomicLongAssert given(AtomicLong actual) {2365 return assumeThat(actual);2366 }2367 /**2368 * Creates a new assumption's instance for an {@link AtomicLongArray} value.2369 * <p>2370 * Examples:2371 * <p>2372 * Executed test:2373 * <pre><code class='java'> {@literal @Test}2374 * public void given_the_assumption_is_met_the_test_is_executed() {2375 * given(new AtomicLongArray(0)).isEmpty();2376 * // the remaining code is executed2377 * // ...2378 * }</code></pre>2379 * <p>2380 * Skipped test:2381 * <pre><code class='java'> {@literal @Test}2382 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2383 * given(new AtomicLongArray(0)).isNotEmpty();2384 * // the remaining code is NOT executed.2385 * // ...2386 *}</code></pre>2387 *2388 * @param actual the actual {@link AtomicLongArray} value to be validated.2389 * @return the {@link AtomicLongArrayAssert} assertion object to be used for assumptions.2390 * @since 3.14.02391 */2392 public static AtomicLongArrayAssert given(AtomicLongArray actual) {2393 return assumeThat(actual);2394 }2395 /**2396 * Creates a new assumption's instance for an {@link AtomicLongFieldUpdater} value.2397 * <p>2398 * Examples:2399 * <pre>{@code2400 * class Yoda {2401 * public volatile long field = 0L;2402 * }2403 * }</pre>2404 * <pre>{@code2405 * AtomicLongFieldUpdater actual = AtomicLongFieldUpdater.newUpdater​(Yoda.class, "field");2406 * Yoda value = new Yoda();2407 * actual.set(value, 1L);2408 * }</pre>2409 * <p>2410 * Executed test:2411 * <pre><code class='java'> {@literal @Test}2412 * public void given_the_assumption_is_met_the_test_is_executed() {2413 * given(actual).hasValue(1L, value);2414 * // the remaining code is executed2415 * // ...2416 * }</code></pre>2417 * <p>2418 * Skipped test:2419 * <pre><code class='java'> {@literal @Test}2420 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2421 * given(actual).hasValue(2L, value));2422 * // the remaining code is NOT executed.2423 * // ...2424 *}</code></pre>2425 *2426 * @param <OBJECT> the type of the object holding the updatable field which gets updated by the the actual value.2427 * @param actual the actual {@link AtomicLongFieldUpdater} value to be validated.2428 * @return the {@link AtomicLongFieldUpdaterAssert} assertion object to be used for assumptions.2429 * @since 3.14.02430 */2431 public static <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> given(AtomicLongFieldUpdater<OBJECT> actual) {2432 return assumeThat(actual);2433 }2434 /**2435 * Creates a new assumption's instance for an {@link AtomicReference} value.2436 * <p>2437 * Examples:2438 * <p>2439 * Executed test:2440 * <pre><code class='java'> {@literal @Test}2441 * public void given_the_assumption_is_met_the_test_is_executed() {2442 * given(new AtomicReference("Yoda")).hasValue("Yoda");2443 * // the remaining code is executed2444 * // ...2445 * }</code></pre>2446 * <p>2447 * Skipped test:2448 * <pre><code class='java'> {@literal @Test}2449 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2450 * given(new AtomicReference("Yoda")).doesNotHaveValue("Yoda");2451 * // the remaining code is NOT executed.2452 * // ...2453 *}</code></pre>2454 *2455 * @param <VALUE> the type of the value contained by the actual reference.2456 * @param actual the actual {@link AtomicReference} to be validated.2457 * @return the {@link AtomicReferenceAssert} assertion object to be used for assumptions.2458 * @since 3.14.02459 */2460 public static <VALUE> AtomicReferenceAssert<VALUE> given(AtomicReference<VALUE> actual) {2461 return assumeThat(actual);2462 }2463 /**2464 * Creates a new assumption's instance for an {@link AtomicReferenceArray} value.2465 * <p>2466 * Examples:2467 * <p>2468 * Executed test:2469 * <pre><code class='java'> {@literal @Test}2470 * public void given_the_assumption_is_met_the_test_is_executed() {2471 * given(new AtomicReferenceArray(0)).isEmpty();2472 * // the remaining code is executed2473 * // ...2474 * }</code></pre>2475 * <p>2476 * Skipped test:2477 * <pre><code class='java'> {@literal @Test}2478 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2479 * given(new AtomicReferenceArray(0)).isNotEmpty();2480 * // the remaining code is NOT executed.2481 * // ...2482 *}</code></pre>2483 *2484 * @param <ELEMENT> the type of the value contained in the actual references' array.2485 * @param actual the actual {@link AtomicReferenceArray} to be validated.2486 * @return the {@link AtomicReferenceArrayAssert} assertion object to be used for assumptions.2487 * @since 3.14.02488 */2489 public static <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> given(AtomicReferenceArray<ELEMENT> actual) {2490 return assumeThat(actual);2491 }2492 /**2493 * Creates a new assumption's instance for an {@link AtomicReferenceFieldUpdater} value.2494 * <p>2495 * Examples:2496 * <pre>{@code2497 * class Yoda {2498 * public volatile String field = "";2499 * }2500 * }</pre>2501 * <pre>{@code2502 * AtomicReferenceFieldUpdater actual = AtomicReferenceFieldUpdater.newUpdater​(Yoda.class, String.class, "field");2503 * Yoda value = new Yoda();2504 * actual.set(value, "Yoda");2505 * }</pre>2506 * <p>2507 * Executed test:2508 * <pre><code class='java'> {@literal @Test}2509 * public void given_the_assumption_is_met_the_test_is_executed() {2510 * given(actual).hasValue("Yoda", value));2511 * // the remaining code is executed2512 * // ...2513 * }</code></pre>2514 * <p>2515 * Skipped test:2516 * <pre><code class='java'> {@literal @Test}2517 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2518 * given(actual).hasValue("", value));2519 * // the remaining code is NOT executed.2520 * // ...2521 *}</code></pre>2522 *2523 * @param <FIELD> the type of the field which gets updated by the the actual updater.2524 * @param <OBJECT> the type of the object holding the updatable field which gets updated by the the actual updater.2525 * @param actual the actual {@link AtomicReferenceFieldUpdater} value to be validated.2526 * @return the {@link AtomicReferenceFieldUpdaterAssert} assertion object to be used for assumptions.2527 * @since 3.14.02528 */2529 public static <FIELD, OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT> given(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual) {2530 return assumeThat(actual);2531 }2532 /**2533 * Creates a new assumption's instance for an {@link AtomicMarkableReference} value.2534 * <p>2535 * Examples:2536 * <p>2537 * Executed test:2538 * <pre><code class='java'> {@literal @Test}2539 * public void given_the_assumption_is_met_the_test_is_executed() {2540 * given(new AtomicMarkableReference("Yoda", true)).isMarked();2541 * // the remaining code is executed2542 * // ...2543 * }</code></pre>2544 * <p>2545 * Skipped test:2546 * <pre><code class='java'> {@literal @Test}2547 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2548 * given(new AtomicMarkableReference("Yoda", true)).isNotMarked();2549 * // the remaining code is NOT executed.2550 * // ...2551 *}</code></pre>2552 *2553 * @param <VALUE> the type of the value contained by the actual reference.2554 * @param actual the actual {@link AtomicMarkableReference} to be validated.2555 * @return the {@link AtomicMarkableReferenceAssert} assertion object to be used for assumptions.2556 * @since 3.14.02557 */2558 public static <VALUE> AtomicMarkableReferenceAssert<VALUE> given(AtomicMarkableReference<VALUE> actual) {2559 return assumeThat(actual);2560 }2561 /**2562 * Creates a new assumption's instance for an {@link AtomicStampedReference} value.2563 * <p>2564 * Examples:2565 * <p>2566 * Executed test:2567 * <pre><code class='java'> {@literal @Test}2568 * public void given_the_assumption_is_met_the_test_is_executed() {2569 * given(new AtomicStampedReference("Yoda", 1)).hasStamp(1);2570 * // the remaining code is executed2571 * // ...2572 * }</code></pre>2573 * <p>2574 * Skipped test:2575 * <pre><code class='java'> {@literal @Test}2576 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2577 * given(new AtomicStampedReference("Yoda", 1)).hasStamp(0);2578 * // the remaining code is NOT executed.2579 * // ...2580 *}</code></pre>2581 *2582 * @param <VALUE> the type of the value contained by the actual reference.2583 * @param actual the actual {@link AtomicStampedReference} to be validated.2584 * @return the {@link AtomicStampedReferenceAssert} assertion object to be used for assumptions.2585 * @since 3.14.02586 */2587 public static <VALUE> AtomicStampedReferenceAssert<VALUE> given(AtomicStampedReference<VALUE> actual) {2588 return assumeThat(actual);2589 }2590 /**2591 * Creates a new assumption's instance for a {@link Date} value.2592 * <p>2593 * Examples:2594 * <p>2595 * Executed test:2596 * <pre><code class='java'> {@literal @Test}2597 * public void given_the_assumption_is_met_the_test_is_executed() {2598 * given(Date.from(Instant.parse("2014-12-03T10:15:30Z"))).isBefore("2016-12-03T10:15:30Z");2599 * // the remaining code is executed2600 * // ...2601 * }</code></pre>2602 * <p>2603 * Skipped test:2604 * <pre><code class='java'> {@literal @Test}2605 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2606 * given(Date.from(Instant.parse("2014-12-03T10:15:30Z"))).isAfter("2016-12-03T10:15:30Z");2607 * // the remaining code is NOT executed.2608 * // ...2609 *}</code></pre>2610 *2611 * @param actual the actual {@link Date} value to be validated.2612 * @return the {@link AbstractDateAssert} assertion object to be used for assumptions.2613 * @since 3.14.02614 */2615 public static AbstractDateAssert<?> given(Date actual) {2616 return assumeThat(actual);2617 }2618 /**2619 * Creates a new assumption's instance for a {@link LocalDate} value.2620 * <p>2621 * Examples:2622 * <p>2623 * Executed test:2624 * <pre><code class='java'> {@literal @Test}2625 * public void given_the_assumption_is_met_the_test_is_executed() {2626 * given(LocalDate.now()).isBeforeOrEqualTo(LocalDate.now());2627 * // the remaining code is executed2628 * // ...2629 * }</code></pre>2630 * <p>2631 * Skipped test:2632 * <pre><code class='java'> {@literal @Test}2633 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2634 * given(LocalDate.now()).isAfter(LocalDate.now());2635 * // the remaining code is NOT executed.2636 * // ...2637 *}</code></pre>2638 *2639 * @param actual the actual {@link LocalDate} value to be validated.2640 * @return the {@link AbstractLocalDateAssert} assertion object to be used for assumptions.2641 * @since 3.14.02642 */2643 public static AbstractLocalDateAssert<?> given(LocalDate actual) {2644 return assumeThat(actual);2645 }2646 /**2647 * Creates a new assumption's instance for a {@link LocalTime} value.2648 * <p>2649 * Examples:2650 * <p>2651 * Executed test:2652 * <pre><code class='java'> {@literal @Test}2653 * public void given_the_assumption_is_met_the_test_is_executed() {2654 * given(LocalTime.now()).isBeforeOrEqualTo(LocalTime.now());2655 * // the remaining code is executed2656 * // ...2657 * }</code></pre>2658 * <p>2659 * Skipped test:2660 * <pre><code class='java'> {@literal @Test}2661 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2662 * given(LocalTime.now()).isAfter(LocalTime.now());2663 * // the remaining code is NOT executed.2664 * // ...2665 *}</code></pre>2666 *2667 * @param actual the actual {@link LocalTime} value to be validated.2668 * @return the {@link AbstractLocalTimeAssert} assertion object to be used for assumptions.2669 * @since 3.14.02670 */2671 public static AbstractLocalTimeAssert<?> given(LocalTime actual) {2672 return assumeThat(actual);2673 }2674 /**2675 * Creates a new assumption's instance for an {@link OffsetTime} value.2676 * <p>2677 * Examples:2678 * <p>2679 * Executed test:2680 * <pre><code class='java'> {@literal @Test}2681 * public void given_the_assumption_is_met_the_test_is_executed() {2682 * given(OffsetTime.now()).isBeforeOrEqualTo(OffsetTime.now());2683 * // the remaining code is executed2684 * // ...2685 * }</code></pre>2686 * <p>2687 * Skipped test:2688 * <pre><code class='java'> {@literal @Test}2689 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2690 * given(OffsetTime.now()).isAfter(OffsetTime.now());2691 * // the remaining code is NOT executed.2692 * // ...2693 *}</code></pre>2694 *2695 * @param actual the actual {@link OffsetTime} value to be validated.2696 * @return the {@link AbstractOffsetTimeAssert} assertion object to be used for assumptions.2697 * @since 3.14.02698 */2699 public static AbstractOffsetTimeAssert<?> given(OffsetTime actual) {2700 return assumeThat(actual);2701 }2702 /**2703 * Creates a new assumption's instance for a {@link LocalDateTime} value.2704 * <p>2705 * Examples:2706 * <p>2707 * Executed test:2708 * <pre><code class='java'> {@literal @Test}2709 * public void given_the_assumption_is_met_the_test_is_executed() {2710 * given(LocalDateTime.now()).isBeforeOrEqualTo(LocalDateTime.now());2711 * // the remaining code is executed2712 * // ...2713 * }</code></pre>2714 * <p>2715 * Skipped test:2716 * <pre><code class='java'> {@literal @Test}2717 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2718 * given(LocalDateTime.now()).isAfter(LocalDateTime.now());2719 * // the remaining code is NOT executed.2720 * // ...2721 *}</code></pre>2722 *2723 * @param actual the actual {@link LocalDateTime} value to be validated.2724 * @return the {@link AbstractLocalDateTimeAssert} assertion object to be used for assumptions.2725 * @since 3.14.02726 */2727 public static AbstractLocalDateTimeAssert<?> given(LocalDateTime actual) {2728 return assumeThat(actual);2729 }2730 /**2731 * Creates a new assumption's instance for an {@link Instant} value.2732 * <p>2733 * Examples:2734 * <p>2735 * Executed test:2736 * <pre><code class='java'> {@literal @Test}2737 * public void given_the_assumption_is_met_the_test_is_executed() {2738 * given(Instant.now()).isBeforeOrEqualTo(Instant.now());2739 * // the remaining code is executed2740 * // ...2741 * }</code></pre>2742 * <p>2743 * Skipped test:2744 * <pre><code class='java'> {@literal @Test}2745 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2746 * given(Instant.now()).isAfter(Instant.now());2747 * // the remaining code is NOT executed.2748 * // ...2749 *}</code></pre>2750 *2751 * @param actual the actual {@link Instant} value to be validated.2752 * @return the {@link AbstractInstantAssert} assertion object to be used for assumptions.2753 * @since 3.14.02754 */2755 public static AbstractInstantAssert<?> given(Instant actual) {2756 return assumeThat(actual);2757 }2758 /**2759 * Creates a new assumption's instance for a {@link Instant} value.2760 *2761 * @param actual the actual value.2762 * @return the created assertion object.2763 * @since 3.15.02764 */2765 public static AbstractDurationAssert<?> given(Duration actual) {2766 return assumeThat(actual);2767 }2768 /**2769 * Creates a new assumption's instance for a {@link java.time.Period} value.2770 *2771 * @param actual the actual value.2772 * @return the created assertion object.2773 * @since 3.17.02774 */2775 public static AbstractPeriodAssert<?> given(Period actual) {2776 return assumeThat(actual);2777 }2778 /**2779 * Creates a new assumption's instance for an {@link OffsetDateTime} value.2780 * <p>2781 * Examples:2782 * <p>2783 * Executed test:2784 * <pre><code class='java'> {@literal @Test}2785 * public void given_the_assumption_is_met_the_test_is_executed() {2786 * given(OffsetDateTime.now()).isBeforeOrEqualTo(OffsetDateTime.now());2787 * // the remaining code is executed2788 * // ...2789 * }</code></pre>2790 * <p>2791 * Skipped test:2792 * <pre><code class='java'> {@literal @Test}2793 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2794 * given(OffsetDateTime.now()).isAfter(OffsetDateTime.now());2795 * // the remaining code is NOT executed.2796 * // ...2797 *}</code></pre>2798 *2799 * @param actual the actual {@link OffsetDateTime} value to be validated.2800 * @return the {@link AbstractOffsetDateTimeAssert} assertion object to be used for assumptions.2801 * @since 3.14.02802 */2803 public static AbstractOffsetDateTimeAssert<?> given(OffsetDateTime actual) {2804 return assumeThat(actual);2805 }2806 /**2807 * Creates a new assumption's instance for a {@link ZonedDateTime} value.2808 * <p>2809 * Examples:2810 * <p>2811 * Executed test:2812 * <pre><code class='java'> {@literal @Test}2813 * public void given_the_assumption_is_met_the_test_is_executed() {2814 * given(ZonedDateTime.now()).isBeforeOrEqualTo(ZonedDateTime.now());2815 * // the remaining code is executed2816 * // ...2817 * }</code></pre>2818 * <p>2819 * Skipped test:2820 * <pre><code class='java'> {@literal @Test}2821 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2822 * given(ZonedDateTime.now()).isAfter(ZonedDateTime.now());2823 * // the remaining code is NOT executed.2824 * // ...2825 *}</code></pre>2826 *2827 * @param actual the actual {@link ZonedDateTime} value to be validated.2828 * @return the {@link AbstractZonedDateTimeAssert} assertion object to be used for assumptions.2829 * @since 3.14.02830 */2831 public static AbstractZonedDateTimeAssert<?> given(ZonedDateTime actual) {2832 return assumeThat(actual);2833 }2834 /**2835 * Creates a new assumption's instance for an {@link InputStream} value.2836 * <p>2837 * Examples:2838 * <p>2839 * Executed test:2840 * <pre><code class='java'> {@literal @Test}2841 * public void given_the_assumption_is_met_the_test_is_executed() {2842 * given(new ByteArrayInputStream​("A".getBytes())).hasContent("A");2843 * // the remaining code is executed2844 * // ...2845 * }</code></pre>2846 * <p>2847 * Skipped test:2848 * <pre><code class='java'> {@literal @Test}2849 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2850 * given(new ByteArrayInputStream​("A".getBytes())).hasContent("B");2851 * // the remaining code is NOT executed.2852 * // ...2853 *}</code></pre>2854 *2855 * @param actual the actual {@link InputStream} value to be validated.2856 * @return the {@link AbstractInputStreamAssert} assertion object to be used for assumptions.2857 * @since 3.14.02858 */2859 public static AbstractInputStreamAssert<?, ? extends InputStream> given(InputStream actual) {2860 return assumeThat(actual);2861 }2862 /**2863 * Creates a new assumption's instance for a {@link File} value.2864 * <p>2865 * Examples:2866 * <p>2867 * Executed test:2868 * <pre><code class='java'> {@literal @Test}2869 * public void given_the_assumption_is_met_the_test_is_executed() {2870 * given(new File("file.ext")).isRelative();2871 * // the remaining code is executed2872 * // ...2873 * }</code></pre>2874 * <p>2875 * Skipped test:2876 * <pre><code class='java'> {@literal @Test}2877 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2878 * given(new File("file.ext")).isAbsolute();2879 * // the remaining code is NOT executed.2880 * // ...2881 *}</code></pre>2882 *2883 * @param actual the actual {@link File} value to be validated.2884 * @return the {@link AbstractFileAssert} assertion object to be used for assumptions.2885 * @since 3.14.02886 */2887 public static AbstractFileAssert<?> given(File actual) {2888 return assumeThat(actual);2889 }2890 /**2891 * Creates a new assumption's instance for a {@link Path} value.2892 * <p>2893 * Examples:2894 * <p>2895 * Executed test:2896 * <pre><code class='java'> {@literal @Test}2897 * public void given_the_assumption_is_met_the_test_is_executed() {2898 * given(new File("file.ext").toPath()).isRelative();2899 * // the remaining code is executed2900 * // ...2901 * }</code></pre>2902 * <p>2903 * Skipped test:2904 * <pre><code class='java'> {@literal @Test}2905 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2906 * given(new File("file.ext").toPath()).isAbsolute();2907 * // the remaining code is NOT executed.2908 * // ...2909 *}</code></pre>2910 *2911 * @param actual the actual {@link Path} value to be validated.2912 * @return the {@link AbstractPathAssert} assertion object to be used for assumptions.2913 * @since 3.14.02914 */2915 public static AbstractPathAssert<?> given(Path actual) {2916 return assumeThat(actual);2917 }2918 /**2919 * Creates a new assumption's instance of a <code>{@link Path}</code> value.2920 * <p>2921 * Use this over {@link #given(Path)} in case of ambiguous method resolution when the object under test2922 * implements several interfaces Assertj provides <code>given</code> for.2923 *2924 * @param actual the actual {@link Path} value to be validated.2925 * @return the {@link AbstractPathAssert} assertion object to be used for assumptions.2926 * @since 3.23.02927 */2928 public static AbstractPathAssert<?> givenPath(Path actual) {2929 return given(actual);2930 }2931 /**2932 * Creates a new assumption's instance for an {@link URI} value.2933 * <p>2934 * Examples:2935 * <p>2936 * Executed test:2937 * <pre><code class='java'> {@literal @Test}2938 * public void given_the_assumption_is_met_the_test_is_executed() {2939 * given(new URI("http://assertj.org")).hasNoPort();2940 * // the remaining code is executed2941 * // ...2942 * }</code></pre>2943 * <p>2944 * Skipped test:2945 * <pre><code class='java'> {@literal @Test}2946 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2947 * given(new URI("http://assertj.org")).hasPort(80);2948 * // the remaining code is NOT executed.2949 * // ...2950 *}</code></pre>2951 *2952 * @param actual the actual {@link URI} value to be validated.2953 * @return the {@link AbstractUriAssert} assertion object to be used for assumptions.2954 * @since 3.14.02955 */2956 public static AbstractUriAssert<?> given(URI actual) {2957 return assumeThat(actual);2958 }2959 /**2960 * Creates a new assumption's instance for an {@link URL} value.2961 * <p>2962 * Examples:2963 * <p>2964 * Executed test:2965 * <pre><code class='java'> {@literal @Test}2966 * public void given_the_assumption_is_met_the_test_is_executed() {2967 * given(new URL("http://assertj.org")).hasProtocol("http");2968 * // the remaining code is executed2969 * // ...2970 * }</code></pre>2971 * <p>2972 * Skipped test:2973 * <pre><code class='java'> {@literal @Test}2974 * public void given_the_assumption_is_not_met_the_test_is_skipped() {2975 * given(new URL("http://assertj.org")).hasPort(80);2976 * // the remaining code is NOT executed.2977 * // ...2978 *}</code></pre>2979 *2980 * @param actual the actual {@link URL} value to be validated....

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful