Best Assertj code snippet using org.assertj.core.api.AbstractDateAssert.hasSecond
Source:AssertJAssertions.java
...604 public AbstractDateAssert hasHourOfDay(int p0) { return (AbstractDateAssert) (Object) null; }605 public AbstractDateAssert isWithinHourOfDay(int p0) { return (AbstractDateAssert) (Object) null; }606 public AbstractDateAssert hasMinute(int p0) { return (AbstractDateAssert) (Object) null; }607 public AbstractDateAssert isWithinMinute(int p0) { return (AbstractDateAssert) (Object) null; }608 public AbstractDateAssert hasSecond(int p0) { return (AbstractDateAssert) (Object) null; }609 public AbstractDateAssert isWithinSecond(int p0) { return (AbstractDateAssert) (Object) null; }610 public AbstractDateAssert hasMillisecond(int p0) { return (AbstractDateAssert) (Object) null; }611 public AbstractDateAssert isWithinMillisecond(int p0) { return (AbstractDateAssert) (Object) null; }612 public AbstractDateAssert isInSameYearAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }613 public AbstractDateAssert isInSameYearAs(java.time.Instant p0) { return (AbstractDateAssert) (Object) null; }614 public AbstractDateAssert isInSameYearAs(String p0) { return (AbstractDateAssert) (Object) null; }615 public AbstractDateAssert isInSameMonthAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }616 public AbstractDateAssert isInSameMonthAs(java.time.Instant p0) { return (AbstractDateAssert) (Object) null; }617 public AbstractDateAssert isInSameMonthAs(String p0) { return (AbstractDateAssert) (Object) null; }618 public AbstractDateAssert isInSameDayAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }619 public AbstractDateAssert isInSameDayAs(java.time.Instant p0) { return (AbstractDateAssert) (Object) null; }620 public AbstractDateAssert isInSameDayAs(String p0) { return (AbstractDateAssert) (Object) null; }621 public AbstractDateAssert isInSameHourWindowAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }622 public AbstractDateAssert isInSameHourWindowAs(java.time.Instant p0) { return (AbstractDateAssert) (Object) null; }623 public AbstractDateAssert isInSameHourWindowAs(String p0) { return (AbstractDateAssert) (Object) null; }624 public AbstractDateAssert isInSameHourAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }625 public AbstractDateAssert isInSameHourAs(String p0) { return (AbstractDateAssert) (Object) null; }626 public AbstractDateAssert isInSameMinuteWindowAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }627 public AbstractDateAssert isInSameMinuteWindowAs(java.time.Instant p0) { return (AbstractDateAssert) (Object) null; }628 public AbstractDateAssert isInSameMinuteWindowAs(String p0) { return (AbstractDateAssert) (Object) null; }629 public AbstractDateAssert isInSameMinuteAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }630 public AbstractDateAssert isInSameMinuteAs(String p0) { return (AbstractDateAssert) (Object) null; }631 public AbstractDateAssert isInSameSecondWindowAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }632 public AbstractDateAssert isInSameSecondWindowAs(java.time.Instant p0) { return (AbstractDateAssert) (Object) null; }633 public AbstractDateAssert isInSameSecondWindowAs(String p0) { return (AbstractDateAssert) (Object) null; }634 public AbstractDateAssert isInSameSecondAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }635 public AbstractDateAssert isInSameSecondAs(String p0) { return (AbstractDateAssert) (Object) null; }636 public AbstractDateAssert isCloseTo(java.util.Date p0, long p1) { return (AbstractDateAssert) (Object) null; }637 public AbstractDateAssert isCloseTo(java.time.Instant p0, long p1) { return (AbstractDateAssert) (Object) null; }638 public AbstractDateAssert isCloseTo(String p0, long p1) { return (AbstractDateAssert) (Object) null; }639 public AbstractDateAssert hasTime(long p0) { return (AbstractDateAssert) (Object) null; }640 public AbstractDateAssert hasSameTimeAs(java.util.Date p0) { return (AbstractDateAssert) (Object) null; }641 public AbstractDateAssert hasSameTimeAs(String p0) { return (AbstractDateAssert) (Object) null; }642 public AbstractDateAssert withDateFormat(java.text.DateFormat p0) { return (AbstractDateAssert) (Object) null; }643 public AbstractDateAssert withDateFormat(String p0) { return (AbstractDateAssert) (Object) null; }644 public static void setLenientDateParsing(boolean p0) {}645 public static void registerCustomDateFormat(java.text.DateFormat p0) {}646 public static void registerCustomDateFormat(String p0) {}647 public static void useDefaultDateFormatsOnly() {}648 public AbstractDateAssert withDefaultDateFormatsOnly() { return (AbstractDateAssert) (Object) null; }649 public AbstractDateAssert usingComparator(java.util.Comparator p0) { return (AbstractDateAssert) (Object) null; }650 public AbstractDateAssert usingComparator(java.util.Comparator p0, String p1) { return (AbstractDateAssert) (Object) null; }651 public AbstractDateAssert usingDefaultComparator() { return (AbstractDateAssert) (Object) null; }652}653---654package org.assertj.core.api;655import java.io.*;656public abstract class AbstractDoubleArrayAssert extends AbstractArrayAssert {657 public void isNullOrEmpty() {}658 public void isEmpty() {}659 public AbstractDoubleArrayAssert isNotEmpty() { return (AbstractDoubleArrayAssert) (Object) null; }660 public AbstractDoubleArrayAssert hasSize(int p0) { return (AbstractDoubleArrayAssert) (Object) null; }661 public AbstractDoubleArrayAssert hasSizeGreaterThan(int p0) { return (AbstractDoubleArrayAssert) (Object) null; }662 public AbstractDoubleArrayAssert hasSizeGreaterThanOrEqualTo(int p0) { return (AbstractDoubleArrayAssert) (Object) null; }663 public AbstractDoubleArrayAssert hasSizeLessThan(int p0) { return (AbstractDoubleArrayAssert) (Object) null; }664 public AbstractDoubleArrayAssert hasSizeLessThanOrEqualTo(int p0) { return (AbstractDoubleArrayAssert) (Object) null; }665 public AbstractDoubleArrayAssert hasSizeBetween(int p0, int p1) { return (AbstractDoubleArrayAssert) (Object) null; }666 public AbstractDoubleArrayAssert hasSameSizeAs(Iterable p0) { return (AbstractDoubleArrayAssert) (Object) null; }667 public AbstractDoubleArrayAssert contains(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }668 public AbstractDoubleArrayAssert contains(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }669 public AbstractDoubleArrayAssert contains(double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }670 public AbstractDoubleArrayAssert contains(Double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }671 public AbstractDoubleArrayAssert containsOnly(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }672 public AbstractDoubleArrayAssert containsOnly(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }673 public AbstractDoubleArrayAssert containsOnly(double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }674 public AbstractDoubleArrayAssert containsOnly(Double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }675 public AbstractDoubleArrayAssert containsOnlyOnce(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }676 public AbstractDoubleArrayAssert containsOnlyOnce(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }677 public AbstractDoubleArrayAssert containsOnlyOnce(double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }678 public AbstractDoubleArrayAssert containsOnlyOnce(Double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }679 public AbstractDoubleArrayAssert containsSequence(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }680 public AbstractDoubleArrayAssert containsSequence(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }681 public AbstractDoubleArrayAssert containsSequence(double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }682 public AbstractDoubleArrayAssert containsSequence(Double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }683 public AbstractDoubleArrayAssert containsSubsequence(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }684 public AbstractDoubleArrayAssert containsSubsequence(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }685 public AbstractDoubleArrayAssert containsSubsequence(double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }686 public AbstractDoubleArrayAssert containsSubsequence(Double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }687 public AbstractDoubleArrayAssert contains(double p0, org.assertj.core.data.Index p1) { return (AbstractDoubleArrayAssert) (Object) null; }688 public AbstractDoubleArrayAssert contains(double p0, org.assertj.core.data.Index p1, org.assertj.core.data.Offset p2) { return (AbstractDoubleArrayAssert) (Object) null; }689 public AbstractDoubleArrayAssert doesNotContain(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }690 public AbstractDoubleArrayAssert doesNotContain(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }691 public AbstractDoubleArrayAssert doesNotContain(double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }692 public AbstractDoubleArrayAssert doesNotContain(Double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }693 public AbstractDoubleArrayAssert doesNotContain(double p0, org.assertj.core.data.Index p1) { return (AbstractDoubleArrayAssert) (Object) null; }694 public AbstractDoubleArrayAssert doesNotContain(double p0, org.assertj.core.data.Index p1, org.assertj.core.data.Offset p2) { return (AbstractDoubleArrayAssert) (Object) null; }695 public AbstractDoubleArrayAssert doesNotHaveDuplicates() { return (AbstractDoubleArrayAssert) (Object) null; }696 public AbstractDoubleArrayAssert doesNotHaveDuplicates(org.assertj.core.data.Offset p0) { return (AbstractDoubleArrayAssert) (Object) null; }697 public AbstractDoubleArrayAssert startsWith(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }698 public AbstractDoubleArrayAssert startsWith(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }699 public AbstractDoubleArrayAssert startsWith(double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }700 public AbstractDoubleArrayAssert startsWith(Double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }701 public AbstractDoubleArrayAssert endsWith(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }702 public AbstractDoubleArrayAssert endsWith(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }703 public AbstractDoubleArrayAssert endsWith(double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }704 public AbstractDoubleArrayAssert endsWith(Double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }705 public AbstractDoubleArrayAssert isSorted() { return (AbstractDoubleArrayAssert) (Object) null; }706 public AbstractDoubleArrayAssert isSortedAccordingTo(java.util.Comparator p0) { return (AbstractDoubleArrayAssert) (Object) null; }707 public AbstractDoubleArrayAssert usingElementComparator(java.util.Comparator p0) { return (AbstractDoubleArrayAssert) (Object) null; }708 public AbstractDoubleArrayAssert usingDefaultElementComparator() { return (AbstractDoubleArrayAssert) (Object) null; }709 public AbstractDoubleArrayAssert containsExactly(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }710 public AbstractDoubleArrayAssert containsExactly(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }711 public AbstractDoubleArrayAssert containsExactlyInAnyOrder(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }712 public AbstractDoubleArrayAssert containsExactlyInAnyOrder(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }713 public AbstractDoubleArrayAssert containsExactly(double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }714 public AbstractDoubleArrayAssert containsExactly(Double[] p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleArrayAssert) (Object) null; }715 public AbstractDoubleArrayAssert usingComparatorWithPrecision(Double p0) { return (AbstractDoubleArrayAssert) (Object) null; }716 public AbstractDoubleArrayAssert containsAnyOf(double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }717 public AbstractDoubleArrayAssert containsAnyOf(Double[] p0) { return (AbstractDoubleArrayAssert) (Object) null; }718}719---720package org.assertj.core.api;721import java.io.*;722public abstract class AbstractDoubleAssert extends AbstractComparableAssert implements FloatingPointNumberAssert {723 public void AbstractDoubleAssert(double p0, Class p1) {}724 public AbstractDoubleAssert isNaN() { return (AbstractDoubleAssert) (Object) null; }725 public AbstractDoubleAssert isNotNaN() { return (AbstractDoubleAssert) (Object) null; }726 public AbstractDoubleAssert isZero() { return (AbstractDoubleAssert) (Object) null; }727 public AbstractDoubleAssert isNotZero() { return (AbstractDoubleAssert) (Object) null; }728 public AbstractDoubleAssert isOne() { return (AbstractDoubleAssert) (Object) null; }729 public AbstractDoubleAssert isPositive() { return (AbstractDoubleAssert) (Object) null; }730 public AbstractDoubleAssert isNegative() { return (AbstractDoubleAssert) (Object) null; }731 public AbstractDoubleAssert isNotNegative() { return (AbstractDoubleAssert) (Object) null; }732 public AbstractDoubleAssert isNotPositive() { return (AbstractDoubleAssert) (Object) null; }733 public AbstractDoubleAssert isCloseTo(double p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleAssert) (Object) null; }734 public AbstractDoubleAssert isNotCloseTo(double p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleAssert) (Object) null; }735 public AbstractDoubleAssert isCloseTo(Double p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleAssert) (Object) null; }736 public AbstractDoubleAssert isNotCloseTo(Double p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleAssert) (Object) null; }737 public AbstractDoubleAssert isCloseTo(Double p0, org.assertj.core.data.Percentage p1) { return (AbstractDoubleAssert) (Object) null; }738 public AbstractDoubleAssert isNotCloseTo(Double p0, org.assertj.core.data.Percentage p1) { return (AbstractDoubleAssert) (Object) null; }739 public AbstractDoubleAssert isCloseTo(double p0, org.assertj.core.data.Percentage p1) { return (AbstractDoubleAssert) (Object) null; }740 public AbstractDoubleAssert isNotCloseTo(double p0, org.assertj.core.data.Percentage p1) { return (AbstractDoubleAssert) (Object) null; }741 public AbstractDoubleAssert isEqualTo(double p0) { return (AbstractDoubleAssert) (Object) null; }742 public AbstractDoubleAssert isEqualTo(Double p0) { return (AbstractDoubleAssert) (Object) null; }743 public AbstractDoubleAssert isEqualTo(Double p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleAssert) (Object) null; }744 public AbstractDoubleAssert isEqualTo(double p0, org.assertj.core.data.Offset p1) { return (AbstractDoubleAssert) (Object) null; }745 public AbstractDoubleAssert isNotEqualTo(double p0) { return (AbstractDoubleAssert) (Object) null; }746 public AbstractDoubleAssert isNotEqualTo(Double p0) { return (AbstractDoubleAssert) (Object) null; }747 public AbstractDoubleAssert isLessThan(double p0) { return (AbstractDoubleAssert) (Object) null; }748 public AbstractDoubleAssert isLessThanOrEqualTo(double p0) { return (AbstractDoubleAssert) (Object) null; }749 public AbstractDoubleAssert isLessThanOrEqualTo(Double p0) { return (AbstractDoubleAssert) (Object) null; }750 public AbstractDoubleAssert isGreaterThan(double p0) { return (AbstractDoubleAssert) (Object) null; }751 public AbstractDoubleAssert isGreaterThanOrEqualTo(double p0) { return (AbstractDoubleAssert) (Object) null; }752 public AbstractDoubleAssert isGreaterThanOrEqualTo(Double p0) { return (AbstractDoubleAssert) (Object) null; }753 public AbstractDoubleAssert isBetween(Double p0, Double p1) { return (AbstractDoubleAssert) (Object) null; }754 public AbstractDoubleAssert isStrictlyBetween(Double p0, Double p1) { return (AbstractDoubleAssert) (Object) null; }755 public AbstractDoubleAssert usingComparator(java.util.Comparator p0) { return (AbstractDoubleAssert) (Object) null; }756 public AbstractDoubleAssert usingComparator(java.util.Comparator p0, String p1) { return (AbstractDoubleAssert) (Object) null; }757 public AbstractDoubleAssert usingDefaultComparator() { return (AbstractDoubleAssert) (Object) null; }758 public AbstractDoubleAssert isFinite() { return (AbstractDoubleAssert) (Object) null; }759 public AbstractDoubleAssert isInfinite() { return (AbstractDoubleAssert) (Object) null; }760 public AbstractComparableAssert isStrictlyBetween(Comparable p0, Comparable p1) { return (AbstractComparableAssert) (Object) null; }761 public AbstractComparableAssert isBetween(Comparable p0, Comparable p1) { return (AbstractComparableAssert) (Object) null; }762 public AbstractComparableAssert isGreaterThanOrEqualTo(Comparable p0) { return (AbstractComparableAssert) (Object) null; }763 public AbstractComparableAssert isLessThanOrEqualTo(Comparable p0) { return (AbstractComparableAssert) (Object) null; }764 public FloatingPointNumberAssert isNotCloseTo(Number p0, org.assertj.core.data.Offset p1) { return (FloatingPointNumberAssert) (Object) null; }765 public FloatingPointNumberAssert isCloseTo(Number p0, org.assertj.core.data.Offset p1) { return (FloatingPointNumberAssert) (Object) null; }766 public FloatingPointNumberAssert isEqualTo(Number p0, org.assertj.core.data.Offset p1) { return (FloatingPointNumberAssert) (Object) null; }767 public NumberAssert isNotCloseTo(Number p0, org.assertj.core.data.Percentage p1) { return (NumberAssert) (Object) null; }768 public NumberAssert isCloseTo(Number p0, org.assertj.core.data.Percentage p1) { return (NumberAssert) (Object) null; }769 public NumberAssert isStrictlyBetween(Number p0, Number p1) { return (NumberAssert) (Object) null; }770 public NumberAssert isBetween(Number p0, Number p1) { return (NumberAssert) (Object) null; }771}772---773package org.assertj.core.api;774import java.io.*;775public abstract class AbstractDurationAssert extends AbstractComparableAssert {776 public AbstractDurationAssert isZero() { return (AbstractDurationAssert) (Object) null; }777 public AbstractDurationAssert isNegative() { return (AbstractDurationAssert) (Object) null; }778 public AbstractDurationAssert isPositive() { return (AbstractDurationAssert) (Object) null; }779 public AbstractDurationAssert hasNanos(long p0) { return (AbstractDurationAssert) (Object) null; }780 public AbstractDurationAssert hasMillis(long p0) { return (AbstractDurationAssert) (Object) null; }781 public AbstractDurationAssert hasSeconds(long p0) { return (AbstractDurationAssert) (Object) null; }782 public AbstractDurationAssert hasMinutes(long p0) { return (AbstractDurationAssert) (Object) null; }783 public AbstractDurationAssert hasHours(long p0) { return (AbstractDurationAssert) (Object) null; }784 public AbstractDurationAssert hasDays(long p0) { return (AbstractDurationAssert) (Object) null; }785 public AbstractDurationAssert isCloseTo(java.time.Duration p0, java.time.Duration p1) { return (AbstractDurationAssert) (Object) null; }786}787---788package org.assertj.core.api;789import java.io.*;790public abstract class AbstractEnumerableAssert extends AbstractAssert implements EnumerableAssert {791 public AbstractEnumerableAssert hasSameSizeAs(Object p0) { return (AbstractEnumerableAssert) (Object) null; }792 public AbstractEnumerableAssert inHexadecimal() { return (AbstractEnumerableAssert) (Object) null; }793 public AbstractEnumerableAssert inBinary() { return (AbstractEnumerableAssert) (Object) null; }794}795---...
Source:AbstractDateAssert.java
...1371 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}.1372 * <p/>1373 * Example:1374 * <pre><code class='java'> // assertion will pass1375 * assertThat(new Date(parseDatetime("2003-04-26T13:20:35").getTime()).hasSecond(35);1376 *1377 * // assertion will fail1378 * assertThat(new Date(parseDatetime("2003-04-26T13:20:35").getTime()).hasSecond(11);</code></pre>1379 *1380 * @param second the second to compare actual second to1381 * @return this assertion object.1382 * @throws AssertionError if the actual {@code Date} is {@code null}.1383 * @throws AssertionError if the actual {@code Date} second is not equal to the given second.1384 */1385 public S hasSecond(int second) {1386 dates.assertHasSecond(info, actual, second);1387 return myself;1388 }1389 1390 /**1391 * @deprecated use {@link #hasSecond(int)} instead.1392 */1393 @Deprecated1394 public S isWithinSecond(int second) {1395 dates.assertHasSecond(info, actual, second);1396 return myself;1397 }1398 1399 /**1400 * Verifies that the actual {@code Date} millisecond is equal to the given millisecond.1401 * <p/>1402 * Examples:1403 * <pre><code class='java'> // assertion will pass1404 * assertThat(parseDatetimeWithMs("2003-04-26T13:20:35.017")).hasMillisecond(17);1405 *1406 * // assertion will fail1407 * assertThat(parseDatetimeWithMs("2003-04-26T13:20:35.017")).hasMillisecond(25);</code></pre>1408 * 1409 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}.1410 *1411 * @param millisecond the millisecond to compare actual millisecond to1412 * @return this assertion object.1413 * @throws AssertionError if the actual {@code Date} is {@code null}.1414 * @throws AssertionError if the actual {@code Date} millisecond is not equal to the given millisecond.1415 */1416 public S hasMillisecond(int millisecond) {1417 dates.assertHasMillisecond(info, actual, millisecond);1418 return myself;1419 }1420 1421 /**1422 * @deprecated use {@link #hasMillisecond(int)} instead.1423 */1424 @Deprecated1425 public S isWithinMillisecond(int second) {1426 dates.assertHasMillisecond(info, actual, second);1427 return myself;1428 }1429 1430 /**1431 * Verifies that actual and given {@code Date} are in the same year.1432 * <p/>1433 * Example:1434 * <pre><code class='java'> Date date1 = parse("2003-04-26");1435 * Date date2 = parse("2003-05-27");1436 *1437 * assertThat(date1).isInSameYearAs(date2);</code></pre>1438 * 1439 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}.1440 *1441 * @param other the given {@code Date} to compare actual {@code Date} to.1442 * @return this assertion object.1443 * @throws NullPointerException if {@code Date} parameter is {@code null}.1444 * @throws AssertionError if the actual {@code Date} is {@code null}.1445 * @throws AssertionError if actual and given {@code Date} are not in the same year.1446 */1447 public S isInSameYearAs(Date other) {1448 dates.assertIsInSameYearAs(info, actual, other);1449 return myself;1450 }1451 /**1452 * Same assertion as {@link #isInSameYearAs(Date)} but given date is represented as String either with one of the1453 * supported defaults date format or a user custom date format (set with method {@link #withDateFormat(DateFormat)}).1454 * <p/>1455 * Beware that the default formats are expressed in the current local timezone.1456 * <p/>1457 * Example:1458 * <pre><code class='java'> Date date1 = parse("2003-04-26");1459 * assertThat(date1).isInSameYearAs("2003-05-27");</code></pre>1460 * 1461 * Defaults date format (expressed in the local time zone) are :1462 * <ul>1463 * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li>1464 * <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li>1465 * <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li>1466 * <li><code>yyyy-MM-dd</code></li>1467 * </ul>1468 * <p/>1469 * Example of valid string date representations:1470 * <ul>1471 * <li><code>2003-04-26T03:01:02.999</code></li>1472 * <li><code>2003-04-26 03:01:02.999</code></li>1473 * <li><code>2003-04-26T13:01:02</code></li>1474 * <li><code>2003-04-26</code></li>1475 * </ul>1476 *1477 * @param dateAsString the given Date represented as String in default or custom date format.1478 * @return this assertion object.1479 * @throws NullPointerException if dateAsString parameter is {@code null}.1480 * @throws AssertionError if the actual {@code Date} is {@code null}.1481 * @throws AssertionError if actual and given Date represented as String are not in the same year.1482 * @throws AssertionError if the given date as String could not be converted to a Date.1483 */1484 public S isInSameYearAs(String dateAsString) {1485 return isInSameYearAs(parse(dateAsString));1486 }1487 /**1488 * Verifies that actual and given {@code Date} have same month and year fields.1489 * <p/>1490 * Example:1491 * <pre><code class='java'> Date date1 = parse("2003-04-26");1492 * Date date2 = parse("2003-04-27");1493 *1494 * assertThat(date1).isInSameMonthAs(date2);</code></pre>1495 * 1496 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}.1497 *1498 * @param other the given {@code Date} to compare actual {@code Date} to.1499 * @return this assertion object.1500 * @throws NullPointerException if {@code Date} parameter is {@code null}.1501 * @throws AssertionError if the actual {@code Date} is {@code null}.1502 * @throws AssertionError if actual and given {@code Date} are not in the same month.1503 */1504 public S isInSameMonthAs(Date other) {1505 dates.assertIsInSameMonthAs(info, actual, other);1506 return myself;1507 }1508 /**1509 * Same assertion as {@link #isInSameMonthAs(Date)}but given date is represented as String either with one of the1510 * supported defaults date format or a user custom date format (set with method {@link #withDateFormat(DateFormat)}).1511 * <p/>1512 * Beware that the default formats are expressed in the current local timezone.1513 * <p/>1514 * Example:1515 * <pre><code class='java'> Date date1 = parse("2003-04-26");1516 * assertThat(date1).isInSameMonthAs("2003-04-27");</code></pre>1517 * 1518 * Defaults date format (expressed in the local time zone) are :1519 * <ul>1520 * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li>1521 * <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li>1522 * <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li>1523 * <li><code>yyyy-MM-dd</code></li>1524 * </ul>1525 * <p/>1526 * Example of valid string date representations:1527 * <ul>1528 * <li><code>2003-04-26T03:01:02.999</code></li>1529 * <li><code>2003-04-26 03:01:02.999</code></li>1530 * <li><code>2003-04-26T13:01:02</code></li>1531 * <li><code>2003-04-26</code></li>1532 * </ul>1533 *1534 * @param dateAsString the given Date represented as String in default or custom date format.1535 * @return this assertion object.1536 * @throws NullPointerException if dateAsString parameter is {@code null}.1537 * @throws AssertionError if the actual {@code Date} is {@code null}.1538 * @throws AssertionError if actual and given {@code Date} are not in the same month.1539 */1540 public S isInSameMonthAs(String dateAsString) {1541 return isInSameMonthAs(parse(dateAsString));1542 }1543 /**1544 * Verifies that actual and given {@code Date} have the same day of month, month and year fields values.1545 * <p/>1546 * Example:1547 * <pre><code class='java'> Date date1 = parseDatetime("2003-04-26T23:17:00");1548 * Date date2 = parseDatetime("2003-04-26T12:30:00");1549 *1550 * assertThat(date1).isInSameDayAs(date2);</code></pre>1551 * 1552 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}.1553 *1554 * @param other the given {@code Date} to compare actual {@code Date} to.1555 * @return this assertion object.1556 * @throws NullPointerException if {@code Date} parameter is {@code null}.1557 * @throws AssertionError if the actual {@code Date} is {@code null}.1558 * @throws AssertionError if actual and given {@code Date} are not in the same day of month.1559 */1560 public S isInSameDayAs(Date other) {1561 dates.assertIsInSameDayAs(info, actual, other);1562 return myself;1563 }1564 /**1565 * Same assertion as {@link #isInSameDayAs(Date)} but given date is represented as String either with one of the1566 * supported defaults date format or a user custom date format (set with method {@link #withDateFormat(DateFormat)}).1567 * <p/>1568 * Beware that the default formats are expressed in the current local timezone.1569 * <p/>1570 * Example:1571 * <pre><code class='java'> Date date1 = parseDatetime("2003-04-26T23:17:00");1572 * assertThat(date1).isInSameDayAs("2003-04-26");</code></pre>1573 * 1574 * Defaults date format (expressed in the local time zone) are :1575 * <ul>1576 * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li>1577 * <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li>1578 * <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li>1579 * <li><code>yyyy-MM-dd</code></li>1580 * </ul>1581 * <p/>1582 * Example of valid string date representations:1583 * <ul>1584 * <li><code>2003-04-26T03:01:02.999</code></li>1585 * <li><code>2003-04-26 03:01:02.999</code></li>1586 * <li><code>2003-04-26T13:01:02</code></li>1587 * <li><code>2003-04-26</code></li>1588 * </ul>1589 *1590 * @param dateAsString the given Date represented as String in default or custom date format.1591 * @return this assertion object.1592 * @throws NullPointerException if dateAsString parameter is {@code null}.1593 * @throws AssertionError if the actual {@code Date} is {@code null}.1594 * @throws AssertionError if actual and given {@code Date} are not in the same day of month.1595 */1596 public S isInSameDayAs(String dateAsString) {1597 return isInSameDayAs(parse(dateAsString));1598 }1599 /**1600 * Verifies that actual and given {@code Date} are chronologically in the same hour (i.e. their time difference <= 11601 * hour).1602 * <p/>1603 * This assertion succeeds as time difference is exactly = 1h:1604 * <pre><code class='java'> Date date1 = parseDatetime("2003-04-26T13:00:00");1605 * Date date2 = parseDatetime("2003-04-26T14:00:00");1606 * assertThat(date1).isInSameHourWindowAs(date2);</code></pre>1607 * 1608 * Two dates can have different hour fields and yet be in the same chronological hour, example:1609 * <pre><code class='java'> Date date1 = parseDatetime("2003-04-26T13:00:00");1610 * Date date2 = parseDatetime("2003-04-26T12:59:59");1611 * // succeeds as time difference == 1s1612 * assertThat(date1).isInSameHourWindowAs(date2);</code></pre>1613 * 1614 * This assertion fails as time difference is more than one hour:1615 * <pre><code class='java'> Date date1 = parseDatetime("2003-04-26T13:00:00");1616 * Date date2 = parseDatetime("2003-04-26T14:00:01");1617 * assertThat(date1).isInSameHourWindowAs(date2);</code></pre>1618 * 1619 * To compare date's hour fields only (without day, month and year), you can write :1620 * <pre><code class='java'> assertThat(myDate).isWithinHour(hourOfDayOf(otherDate));</code></pre>1621 * 1622 * see {@link org.assertj.core.util.DateUtil#hourOfDayOf(java.util.Date) hourOfDayOf} to get the hour of a given Date.1623 * <p/>1624 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}).1625 *1626 * @param other the given {@code Date} to compare actual {@code Date} to.1627 * @return this assertion object.1628 * @throws NullPointerException if {@code Date} parameter is {@code null}.1629 * @throws AssertionError if the actual {@code Date} is {@code null}.1630 * @throws AssertionError if actual and given {@code Date} are not in the same hour.1631 */1632 public S isInSameHourWindowAs(Date other) {1633 dates.assertIsInSameHourWindowAs(info, actual, other);1634 return myself;1635 }1636 /**1637 * Same assertion as {@link #isInSameHourWindowAs(java.util.Date)} but given date is represented as String either1638 * with one of the supported defaults date format or a user custom date format (set with method1639 * {@link #withDateFormat(DateFormat)}).1640 * <p/>1641 * Beware that the default formats are expressed in the current local timezone.1642 * <p/>1643 * Defaults date format (expressed in the local time zone) are :1644 * <ul>1645 * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li>1646 * <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li>1647 * <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li>1648 * <li><code>yyyy-MM-dd</code></li>1649 * </ul>1650 * <p/>1651 * Example of valid string date representations:1652 * <ul>1653 * <li><code>2003-04-26T03:01:02.999</code></li>1654 * <li><code>2003-04-26 03:01:02.999</code></li>1655 * <li><code>2003-04-26T13:01:02</code></li>1656 * <li><code>2003-04-26</code></li>1657 * </ul>1658 *1659 * @param dateAsString the given Date represented as String in default or custom date format.1660 * @return this assertion object.1661 * @throws NullPointerException if dateAsString parameter is {@code null}.1662 * @throws AssertionError if the actual {@code Date} is {@code null}.1663 * @throws AssertionError if actual and given {@code Date} are not in the same day of month.1664 */1665 public S isInSameHourWindowAs(String dateAsString) {1666 return isInSameHourWindowAs(parse(dateAsString));1667 }1668 /**1669 * Verifies that actual and given {@code Date} have same hour, day, month and year fields values.1670 * <p/>1671 * Example:1672 * <pre><code class='java'> Date date1 = parseDatetime("2003-01-01T12:00:00");1673 * Date date2 = parseDatetime("2003-01-01T12:30:00");1674 *1675 * // succeeds1676 * assertThat(date1).isInSameHourAs(date2);</code></pre>1677 * 1678 * <b>This assertion does not make a true chronological comparison</b> since two dates can have different hour fields1679 * and yet be in the same chronological hour, e.g:1680 * 1681 * <pre><code class='java'> // dates in the same hour time window but with different hour fields1682 * Date date1 = parseDatetime("2003-01-01T12:00:00");1683 * Date date2 = parseDatetime("2003-01-01T11:59:00");</code></pre>1684 * 1685 * If you want to assert that two dates are chronologically in the same hour time window use1686 * {@link #isInSameHourWindowAs(java.util.Date) isInSameHourWindowAs} assertion (note that if1687 * <code>isInSameHourAs</code> succeeds then <code>isInSameHourWindowAs</code> will succeed too).1688 * <p/>1689 * If you want to compare hour only (without day, month and year), you could write :1690 * <code>assertThat(myDate).isWithinHour(hourOfDayOf(otherDate))</code><br>1691 * see {@link org.assertj.core.util.DateUtil#hourOfDayOf(Date)} to get the hour of a given Date.1692 * <p/>1693 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}.1694 *1695 * @param other the given {@code Date} to compare actual {@code Date} to.1696 * @return this assertion object.1697 * @throws NullPointerException if {@code Date} parameter is {@code null}.1698 * @throws AssertionError if the actual {@code Date} is {@code null}.1699 * @throws AssertionError if actual and given {@code Date} are not in the same hour.1700 */1701 public S isInSameHourAs(Date other) {1702 dates.assertIsInSameHourAs(info, actual, other);1703 return myself;1704 }1705 /**1706 * Same assertion as {@link #isInSameHourAs(Date)} but given date is represented as String either with one of the1707 * supported defaults date format or a user custom date format (set with method {@link #withDateFormat(DateFormat)}).1708 * <p/>1709 * Beware that the default formats are expressed in the current local timezone.1710 * <p/>1711 * Defaults date format (expressed in the local time zone) are :1712 * <ul>1713 * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li>1714 * <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li>1715 * <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li>1716 * <li><code>yyyy-MM-dd</code></li>1717 * </ul>1718 * <p/>1719 * Example of valid string date representations:1720 * <ul>1721 * <li><code>2003-04-26T03:01:02.999</code></li>1722 * <li><code>2003-04-26 03:01:02.999</code></li>1723 * <li><code>2003-04-26T13:01:02</code></li>1724 * <li><code>2003-04-26</code></li>1725 * </ul>1726 *1727 * @param dateAsString the given Date represented as String in default or custom date format.1728 * @return this assertion object.1729 * @throws NullPointerException if dateAsString parameter is {@code null}.1730 * @throws AssertionError if the actual {@code Date} is {@code null}.1731 * @throws AssertionError if actual and given {@code Date} are not in the same hour.1732 */1733 public S isInSameHourAs(String dateAsString) {1734 return isInSameHourAs(parse(dateAsString));1735 }1736 /**1737 * Verifies that actual and given {@code Date} are chronologically in the same minute (i.e. their time difference <= 11738 * minute).1739 * <p/>1740 * Example:1741 * <pre><code class='java'> Date date1 = parseDatetime("2003-01-01T12:01:00");1742 * Date date2 = parseDatetime("2003-01-01T12:01:30");1743 *1744 * // succeeds because date time difference < 1 min1745 * assertThat(date1).isInSameMinuteWindowAs(date2);</code></pre>1746 * 1747 * Two dates can have different minute fields and yet be in the same chronological minute, example:1748 * <pre><code class='java'> Date date1 = parseDatetime("2003-01-01T12:01:00");1749 * Date date3 = parseDatetime("2003-01-01T12:00:59");1750 *1751 * // succeeds as time difference == 1s even though minutes fields differ1752 * assertThat(date1).isInSameMinuteWindowAs(date3);</code></pre>1753 * 1754 * This assertion fails as time difference is >= one minute:1755 * <pre><code class='java'> Date date1 = parseDatetime("2003-01-01T12:01:00");1756 * Date date2 = parseDatetime("2003-01-01T12:02:00");1757 *1758 * // fails, time difference should hae been < 1 min1759 * assertThat(date1).isInSameMinuteWindowAs(date2); // ERROR</code></pre>1760 * 1761 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}).1762 *1763 * @param other the given {@code Date} to compare actual {@code Date} to.1764 * @return this assertion object.1765 * @throws NullPointerException if {@code Date} parameter is {@code null}.1766 * @throws AssertionError if the actual {@code Date} is {@code null}.1767 * @throws AssertionError if actual and given {@code Date} are not in the same minute.1768 */1769 public S isInSameMinuteWindowAs(Date other) {1770 dates.assertIsInSameMinuteWindowAs(info, actual, other);1771 return myself;1772 }1773 /**1774 * Same assertion as {@link #isInSameMinuteWindowAs(Date)} but given date is represented as String either with one of1775 * the supported defaults date format or a user custom date format (set with method1776 * {@link #withDateFormat(DateFormat)}).1777 * <p/>1778 * Beware that the default formats are expressed in the current local timezone.1779 * <p/>1780 * Defaults date format (expressed in the local time zone) are :1781 * <ul>1782 * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li>1783 * <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li>1784 * <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li>1785 * <li><code>yyyy-MM-dd</code></li>1786 * </ul>1787 * <p/>1788 * Example of valid string date representations:1789 * <ul>1790 * <li><code>2003-04-26T03:01:02.999</code></li>1791 * <li><code>2003-04-26 03:01:02.999</code></li>1792 * <li><code>2003-04-26T13:01:02</code></li>1793 * <li><code>2003-04-26</code></li>1794 * </ul>1795 *1796 * @param dateAsString the given Date represented as String in default or custom date format.1797 * @return this assertion object.1798 * @throws NullPointerException if dateAsString parameter is {@code null}.1799 * @throws AssertionError if the actual {@code Date} is {@code null}.1800 * @throws AssertionError if actual and given {@code Date} are not in the same minute.1801 */1802 public S isInSameMinuteWindowAs(String dateAsString) {1803 return isInSameMinuteWindowAs(parse(dateAsString));1804 }1805 /**1806 * Verifies that actual and given {@code Date} have same minute, same hour, day, month and year fields values.1807 * <p/>1808 * Example:1809 * <pre><code class='java'> Date date1 = parseDatetime("2003-01-01T12:01:00");1810 * Date date2 = parseDatetime("2003-01-01T12:01:30");1811 *1812 * // succeeds because the all the fields up to minutes are the same1813 * assertThat(date1).isInSameMinuteAs(date2);</code></pre>1814 * 1815 * <b>It does not make a true chronological comparison</b> since two dates can have different minute fields and yet be1816 * in the same chronological minute, e.g:1817 * <pre><code class='java'> // dates in the same minute time window but with different minute fields1818 * Date date1 = parseDatetime("2003-01-01T12:01:00");1819 * Date date3 = parseDatetime("2003-01-01T12:00:59");1820 *1821 * // fails because minutes fields differ even though time difference is only 1s !1822 * assertThat(date1).isInSameMinuteAs(date3); // ERROR</code></pre>1823 * 1824 * If you want to assert that two dates are in the same minute time window use1825 * {@link #isInSameMinuteWindowAs(java.util.Date) isInSameMinuteWindowAs} assertion (note that if1826 * <code>isInSameMinuteAs</code> succeeds then <code>isInSameMinuteWindowAs</code> will succeed too).1827 * <p/>1828 * If you want to compare minute field only (without hour, day, month and year), you could write :1829 * <code>assertThat(myDate).hasMinute(minuteOf(otherDate))</code><br>1830 * using {@link org.assertj.core.util.DateUtil#minuteOf(Date)} to get the minute of a given Date.1831 * <p/>1832 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}).1833 *1834 * @param other the given {@code Date} to compare actual {@code Date} to.1835 * @return this assertion object.1836 * @throws NullPointerException if {@code Date} parameter is {@code null}.1837 * @throws AssertionError if the actual {@code Date} is {@code null}.1838 * @throws AssertionError if actual and given {@code Date} are not in the same minute.1839 */1840 public S isInSameMinuteAs(Date other) {1841 dates.assertIsInSameMinuteAs(info, actual, other);1842 return myself;1843 }1844 /**1845 * Same assertion as {@link #isInSameMinuteAs(Date)} but given date is represented as String either with one of the1846 * supported defaults date format or a user custom date format (set with method {@link #withDateFormat(DateFormat)}).1847 * <p/>1848 * Beware that the default formats are expressed in the current local timezone.1849 * <p/>1850 * Defaults date format (expressed in the local time zone) are :1851 * <ul>1852 * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li>1853 * <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li>1854 * <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li>1855 * <li><code>yyyy-MM-dd</code></li>1856 * </ul>1857 * <p/>1858 * Example of valid string date representations:1859 * <ul>1860 * <li><code>2003-04-26T03:01:02.999</code></li>1861 * <li><code>2003-04-26 03:01:02.999</code></li>1862 * <li><code>2003-04-26T13:01:02</code></li>1863 * <li><code>2003-04-26</code></li>1864 * </ul>1865 *1866 * @param dateAsString the given Date represented as String in default or custom date format.1867 * @return this assertion object.1868 * @throws NullPointerException if dateAsString parameter is {@code null}.1869 * @throws AssertionError if the actual {@code Date} is {@code null}.1870 * @throws AssertionError if actual and given {@code Date} are not in the same minute.1871 */1872 public S isInSameMinuteAs(String dateAsString) {1873 return isInSameMinuteAs(parse(dateAsString));1874 }1875 /**1876 * Verifies that actual and given {@code Date} are chronologically strictly in the same second (i.e. their time1877 * difference < 1 second).1878 * <p/>1879 * Example:1880 * <pre><code class='java'> Date date1 = parseDatetimeWithMs("2003-04-26T13:01:02.123");1881 * Date date2 = parseDatetimeWithMs("2003-04-26T13:01:02.456");1882 *1883 * // succeeds as time difference is < 1s1884 * assertThat(date1).isInSameSecondWindowAs(date2);</code></pre>1885 * 1886 * Two dates can have different second fields and yet be in the same chronological second, example:1887 * <pre><code class='java'> Date date1 = parseDatetimeWithMs("2003-04-26T13:01:02.999");1888 * Date date2 = parseDatetimeWithMs("2003-04-26T13:01:03.000");1889 *1890 * // succeeds as time difference is 1ms < 1s1891 * assertThat(date1).isInSameSecondWindowAs(date2);</code></pre>1892 * 1893 * Those assertions fail as time difference is greater or equal to one second:1894 * <pre><code class='java'> Date date1 = parseDatetimeWithMs("2003-04-26T13:01:01.000");1895 * Date date2 = parseDatetimeWithMs("2003-04-26T13:01:02.000");1896 *1897 * // fails as time difference = 1s1898 * assertThat(date1).isInSameSecondWindowAs(date2); // ERROR1899 *1900 * Date date3 = parseDatetimeWithMs("2003-04-26T13:01:02.001");1901 * // fails as time difference > 1s1902 * assertThat(date1).isInSameSecondWindowAs(date3); // ERROR</code></pre>1903 * 1904 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}.1905 *1906 * @param other the given {@code Date} to compare actual {@code Date} to.1907 * @return this assertion object.1908 * @throws NullPointerException if {@code Date} parameter is {@code null}.1909 * @throws AssertionError if the actual {@code Date} is {@code null}.1910 * @throws AssertionError if actual and given {@code Date} are not in the same second.1911 */1912 public S isInSameSecondWindowAs(Date other) {1913 dates.assertIsInSameSecondWindowAs(info, actual, other);1914 return myself;1915 }1916 /**1917 * Same assertion as {@link #isInSameSecondWindowAs(Date)} but given date is represented as String either with one of1918 * the supported defaults date format or a user custom date format (set with method1919 * {@link #withDateFormat(DateFormat)}).1920 * <p/>1921 * Beware that the default formats are expressed in the current local timezone.1922 * <p/>1923 * Defaults date format (expressed in the local time zone) are :1924 * <ul>1925 * <li><code>yyyy-MM-dd'T'HH:mm:ss.SSS</code></li>1926 * <li><code>yyyy-MM-dd HH:mm:ss.SSS</code></li>1927 * <li><code>yyyy-MM-dd'T'HH:mm:ss</code></li>1928 * <li><code>yyyy-MM-dd</code></li>1929 * </ul>1930 * <p/>1931 * Example of valid string date representations:1932 * <ul>1933 * <li><code>2003-04-26T03:01:02.999</code></li>1934 * <li><code>2003-04-26 03:01:02.999</code></li>1935 * <li><code>2003-04-26T13:01:02</code></li>1936 * <li><code>2003-04-26</code></li>1937 * </ul>1938 *1939 * @param dateAsString the given Date represented as String.1940 * @throws NullPointerException if dateAsString parameter is {@code null}.1941 * @throws AssertionError if the actual {@code Date} is {@code null}.1942 * @throws AssertionError if actual and given {@code Date} are not in the same second.1943 */1944 public S isInSameSecondWindowAs(String dateAsString) {1945 return isInSameSecondWindowAs(parse(dateAsString));1946 }1947 /**1948 * Verifies that actual and given {@code Date} have same second, minute, hour, day, month and year fields values.1949 * 1950 * <pre><code class='java'> Date date1 = parseDatetimeWithMs("2003-01-01T12:00:01.000");1951 * Date date2 = parseDatetimeWithMs("2003-01-01T12:00:01.250");1952 *1953 * // succeeds because the all the time fields up to seconds are the same1954 * assertThat(date1).isInSameSecondAs(date2);</code></pre>1955 * 1956 * <b>It does not make a true chronological comparison</b> since two dates can have different second fields and yet1957 * be1958 * in the same chronological second, e.g:1959 * <pre><code class='java'> Date date1 = parseDatetimeWithMs("2003-01-01T12:00:01.000");1960 * Date date3 = parseDatetimeWithMs("2003-01-01T12:00:00.999");1961 *1962 * // fails because seconds fields differ even though time difference is only 1ms !1963 * assertThat(date1).isInSameSecondAs(date3); // ERROR</code></pre>1964 * 1965 * If you want to assert that two dates are in the same second time window use1966 * {@link #isInSameSecondWindowAs(java.util.Date) isInSameSecondWindowAs} assertion.1967 * <p/>1968 * If you want to compare second fields only (without minute, hour, day, month and year), you could write :1969 * <code>assertThat(myDate).hasSecond(secondOf(otherDate))</code><br>1970 * using {@link org.assertj.core.util.DateUtil#secondOf(Date)} to get the second of a given Date.1971 * <p/>1972 * Note that using a custom comparator has no effect on this assertion (see {@link #usingComparator(Comparator)}).1973 *1974 * @param other the given {@code Date} to compare actual {@code Date} to.1975 * @return this assertion object.1976 * @throws NullPointerException if {@code Date} parameter is {@code null}.1977 * @throws AssertionError if the actual {@code Date} is {@code null}.1978 * @throws AssertionError if actual and given {@code Date} are not in the same second.1979 */1980 public S isInSameSecondAs(Date other) {1981 dates.assertIsInSameSecondAs(info, actual, other);1982 return myself;1983 }...
hasSecond
Using AI Code Generation
1import org.junit.Test;2import org.junit.runner.RunWith;3import org.springframework.boot.test.context.SpringBootTest;4import org.springframework.test.context.junit4.SpringRunner;5import java.util.Date;6import static org.assertj.core.api.Assertions.assertThat;7@RunWith(SpringRunner.class)8public class DateAssertTest {9 public void testDateAssert() {10 Date date = new Date();11 assertThat(date).hasSecond(0);12 }13}14 at org.junit.Assert.assertEquals(Assert.java:115)15 at org.junit.Assert.assertEquals(Assert.java:144)16 at org.assertj.core.api.AbstractDateAssert.hasSecond(AbstractDateAssert.java:111)17 at com.example.demo.DateAssertTest.testDateAssert(DateAssertTest.java:17)18 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)19 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)20 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)21 at java.lang.reflect.Method.invoke(Method.java:498)22 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)23 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)24 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)25 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)26 at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)27 at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)28 at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)29 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)30 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)31 at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)32 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)33 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)34 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)35 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
hasSecond
Using AI Code Generation
1import org.assertj.core.api.AbstractDateAssert;2import org.assertj.core.api.Assertions;3import java.util.Date;4public class 1 {5 public static void main(String[] args) {6 Date date = new Date();7 AbstractDateAssert<?> abs = Assertions.assertThat(date);8 abs.hasSecond(0);9 }10}11import org.assertj.core.api.AbstractDateAssert;12import org.assertj.core.api.Assertions;13import java.util.Date;14public class 2 {15 public static void main(String[] args) {16 Date date = new Date();17 AbstractDateAssert<?> abs = Assertions.assertThat(date);18 abs.hasMonthOfYear(1);19 }20}21import org.assertj.core.api.AbstractDateAssert;22import org.assertj.core.api.Assertions;23import java.util.Date;24public class 3 {25 public static void main(String[] args) {26 Date date = new Date();27 AbstractDateAssert<?> abs = Assertions.assertThat(date);28 abs.hasDayOfYear(1);29 }30}31import org.assertj.core.api.AbstractDateAssert;32import org.assertj.core.api.Assertions;33import java.util.Date;34public class 4 {35 public static void main(String[] args) {36 Date date = new Date();37 AbstractDateAssert<?> abs = Assertions.assertThat(date);38 abs.hasDayOfMonth(1);39 }40}41import org.assertj.core.api.AbstractDateAssert;42import org.assertj.core.api.Assertions;43import java.util.Date;44public class 5 {45 public static void main(String[] args) {46 Date date = new Date();47 AbstractDateAssert<?> abs = Assertions.assertThat(date);48 abs.hasHourOfDay(0);49 }50}51import org.assertj.core.api.AbstractDateAssert;52import org.assertj.core.api.Assertions;53import java.util.Date;54public class 6 {55 public static void main(String[] args) {56 Date date = new Date();
hasSecond
Using AI Code Generation
1import static org.assertj.core.api.Assertions.assertThat;2import java.util.Date;3import java.util.Calendar;4public class Test {5 public static void main(String[] args) {6 Date date = new Date();7 Calendar calendar = Calendar.getInstance();8 calendar.set(2017, 5, 25, 10, 10, 10);9 Date date1 = calendar.getTime();10 assertThat(date).hasSecond(10);11 assertThat(date1).hasSecond(10);12 }13}14at org.assertj.core.api.AbstractDateAssert.hasSecond(AbstractDateAssert.java:181)15at Test.main(Test.java:11)
hasSecond
Using AI Code Generation
1public class AssertJDateAssert {2 public static void main(String[] args) {3 Date date = new Date();4 assertThat(date).hasSecond(0);5 }6}
hasSecond
Using AI Code Generation
1public void testHasSecond() {2 Date date = new Date();3 assertThat(date).hasSecond(0);4}5public void testIsAfterOrEqualTo() {6 Date date = new Date();7 assertThat(date).isAfterOrEqualTo(date);8}9public void testIsBeforeOrEqualTo() {10 Date date = new Date();11 assertThat(date).isBeforeOrEqualTo(date);12}13public void testIsBetween() {14 Date date = new Date();15 assertThat(date).isBetween(date, date);16}17public void testIsCloseTo() {18 Date date = new Date();19 assertThat(date).isCloseTo(date, 1000);20}21public void testIsNotAfter() {22 Date date = new Date();23 assertThat(date).isNotAfter(date);24}25public void testIsNotBefore() {26 Date date = new Date();27 assertThat(date).isNotBefore(date);28}29public void testIsNotEqualTo() {30 Date date = new Date();31 assertThat(date).isNotEqualTo(date);32}33public void testIsNotIn() {34 Date date = new Date();35 assertThat(date).isNotIn(date, date);36}37public void testIsNotSameAs() {38 Date date = new Date();39 assertThat(date).isNotSameAs(date);40}41public void testIsSameAs() {42 Date date = new Date();43 assertThat(date).isSameAs(date);44}
hasSecond
Using AI Code Generation
1import org.assertj.core.api.AbstractDateAssert;2import java.util.Date;3public class AssertJTest {4 public static void main(String[] args) {5 Date date = new Date(2019, 10, 01);6 AbstractDateAssert<?> abstractDateAssert = new AbstractDateAssert<>(date, AssertJTest.class);7 System.out.println(abstractDateAssert.hasSecond(1));8 }9}10import org.assertj.core.api.Assertions;11import java.util.Date;12public class AssertJTest {13 public static void main(String[] args) {14 Date date = new Date(2019, 10, 01);15 Assertions assertions = new Assertions();16 System.out.println(assertions.hasSecond(date, 1));17 }18}19public AbstractDateAssert<S> hasSecond(int second)
hasSecond
Using AI Code Generation
1import static org.assertj.core.api.Assertions.assertThat;2import java.util.Date;3public class AssertJDateAssert {4 public static void main(String[] args) {5 Date date = new Date();6 assertThat(date).hasSecond(0);7 }8}
hasSecond
Using AI Code Generation
1public class AbstractDateAssert_hasSecond_Test {2 public static void main(String[] args) {3 LocalDate date = LocalDate.of(2018, 1, 1);4 assertThat(date).hasSecond(1);5 }6}7AssertJ – AbstractDateAssert.hasHour()8AssertJ – AbstractDateAssert.hasMinute()9AssertJ – AbstractDateAssert.hasMillisecond()10AssertJ – AbstractDateAssert.hasMonth()11AssertJ – AbstractDateAssert.hasYear()12AssertJ – AbstractDateAssert.isAfter()13AssertJ – AbstractDateAssert.isAfterOrEqualTo()14AssertJ – AbstractDateAssert.isBefore()15AssertJ – AbstractDateAssert.isBeforeOrEqualTo()16AssertJ – AbstractDateAssert.isEqualToIgnoringHours()17AssertJ – AbstractDateAssert.isEqualToIgnoringMinutes()18AssertJ – AbstractDateAssert.isEqualToIgnoringSeconds()19AssertJ – AbstractDateAssert.isEqualToIgnoringMillis()20AssertJ – AbstractDateAssert.isEqualToIgnoringNanos()21AssertJ – AbstractDateAssert.isEqualToIgnoringTimezone()22AssertJ – AbstractDateAssert.isInSameHourWindowAs()23AssertJ – AbstractDateAssert.isInSameMinuteWindowAs()24AssertJ – AbstractDateAssert.isInSameSecondWindowAs()25AssertJ – AbstractDateAssert.isInSameMillisecondWindowAs()26AssertJ – AbstractDateAssert.isInSameNanoSecondWindowAs()27AssertJ – AbstractDateAssert.isInSameHourWindowAs()28AssertJ – AbstractDateAssert.isInSameMinuteWindowAs()29AssertJ – AbstractDateAssert.isInSameSecondWindowAs()30AssertJ – AbstractDateAssert.isInSameMillisecondWindowAs()31AssertJ – AbstractDateAssert.isInSameNanoSecondWindowAs()32AssertJ – AbstractDateAssert.isInSameHourWindowAs()33AssertJ – AbstractDateAssert.isInSameMinuteWindowAs()34AssertJ – AbstractDateAssert.isInSameSecondWindowAs()35AssertJ – AbstractDateAssert.isInSameMillisecondWindowAs()36AssertJ – AbstractDateAssert.isInSameNanoSecondWindowAs()37AssertJ – AbstractDateAssert.isInSameHourWindowAs()38AssertJ – AbstractDateAssert.isInSameMinuteWindowAs()39AssertJ – AbstractDateAssert.isInSameSecondWindowAs()
hasSecond
Using AI Code Generation
1import org.assertj.core.api.Assertions;2import org.assertj.core.api.AbstractDateAssert;3import java.util.Date;4public class AssertjDateAssert {5 public static void main(String[] args) {6 Date date = new Date();7 AbstractDateAssert<?> assertDate = Assertions.assertThat(date);8 assertDate.hasSecond(0);9 System.out.println("date has second 0");10 }11}
hasSecond
Using AI Code Generation
1import static org.assertj.core.api.Assertions.*;2import java.util.Date;3import org.junit.Test;4public class AssertJDateAssertTest {5 public void testDateAssert() {6 Date date = new Date(2016, 1, 1, 1, 1, 1);7 assertThat(date).hasSecond(0);8 }9}10at AssertJDateAssertTest.testDateAssert(AssertJDateAssertTest.java:11)
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!