How to use convertToOffsetDateTimeArray method of org.assertj.core.api.AbstractOffsetDateTimeAssert class

Best Assertj code snippet using org.assertj.core.api.AbstractOffsetDateTimeAssert.convertToOffsetDateTimeArray

Source:AbstractOffsetDateTimeAssert.java Github

copy

Full Screen

...517 * from given Strings.518 */519 public SELF isIn(String... dateTimesAsString) {520 checkIsNotNullAndNotEmpty(dateTimesAsString);521 return isIn(convertToOffsetDateTimeArray(dateTimesAsString));522 }523 /**524 * Same assertion as {@link #isNotIn(Object...)} (where Objects are expected to be {@link java.time.OffsetDateTime})525 * but here you526 * pass {@link java.time.OffsetDateTime} String representations that must follow <a href=527 * "http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#ISO_OFFSET_DATE_TIME"528 * >ISO OffsetDateTime format</a> to allow calling {@link java.time.OffsetDateTime#parse(CharSequence)} method.529 * <p>530 * Example :531 * <pre><code class='java'> // use String based representation of OffsetDateTime532 * assertThat(parse("2000-01-01T00:00:00Z")).isNotIn("1999-12-31T00:00:00Z",533 * "2000-01-02T00:00:00Z");</code></pre>534 *535 * @param dateTimesAsString Array of String representing a {@link java.time.OffsetDateTime}.536 * @return this assertion object.537 * @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.538 * @throws IllegalArgumentException if given String is null or can't be converted to a539 * {@link java.time.OffsetDateTime}.540 * @throws AssertionError if the actual {@code OffsetDateTime} is in the {@link java.time.OffsetDateTime}s built from541 * given Strings.542 */543 public SELF isNotIn(String... dateTimesAsString) {544 checkIsNotNullAndNotEmpty(dateTimesAsString);545 return isNotIn(convertToOffsetDateTimeArray(dateTimesAsString));546 }547 /**548 * Verifies that actual and given {@code OffsetDateTime} have same year, month, day, hour, minute and second fields,549 * (nanosecond fields are ignored in comparison).550 * <p>551 * Assertion can fail with OffsetDateTimes in same chronological nanosecond time window, e.g :552 * <p>553 * 2000-01-01T00:00:<b>01.000000000</b>+01:00 and 2000-01-01T00:00:<b>00.999999999</b>+01:00.554 * <p>555 * Assertion fails as second fields differ even if time difference is only 1ns.556 * <p>557 * Code example :558 * <pre><code class='java'> // successful assertions559 * OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.UTC);560 * OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 456, ZoneOffset.UTC);561 * assertThat(OffsetDateTime1).isEqualToIgnoringNanos(OffsetDateTime2);</code></pre>562 *563 * <pre><code class='java'> // failing assertions (even if time difference is only 1ns)564 * OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.UTC);565 * OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 0, 0, 0, 999999999, ZoneOffset.UTC);566 * assertThat(OffsetDateTimeA).isEqualToIgnoringNanos(OffsetDateTimeB);</code></pre>567 *568 * @param other the given {@link java.time.OffsetDateTime}.569 * @return this assertion object.570 * @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.571 * @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.572 * @throws AssertionError if the actual {@code OffsetDateTime} is are not equal with nanoseconds ignored.573 */574 public SELF isEqualToIgnoringNanos(OffsetDateTime other) {575 Objects.instance().assertNotNull(info, actual);576 assertOffsetDateTimeParameterIsNotNull(other);577 if (!areEqualIgnoringNanos(actual, other)) {578 throw Failures.instance().failure(info, shouldBeEqualIgnoringNanos(actual, other));579 }580 return myself;581 }582 /**583 * Verifies that actual and given {@code OffsetDateTime} have same year, month, day, hour, minute, second and584 * nanosecond fields,585 * (timezone fields are ignored in comparison).586 * <p>587 * Code example :588 * <pre><code class='java'> // successful assertions589 * OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.UTC);590 * OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.MAX);591 * assertThat(OffsetDateTime1).isEqualToIgnoringTimezone(OffsetDateTime2);592 *593 * // failing assertions594 * OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 1, 0, 0, 1, 0, ZoneOffset.UTC);595 * OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 0, 0, 0, 999999999, ZoneOffset.UTC);596 * assertThat(OffsetDateTimeA).isEqualToIgnoringTimezone(OffsetDateTimeB);</code></pre>597 *598 * @param other the given {@link java.time.OffsetDateTime}.599 * @return this assertion object.600 * @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.601 * @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.602 * @throws AssertionError if the actual {@code OffsetDateTime} is are not equal with timezone ignored.603 */604 public SELF isEqualToIgnoringTimezone(OffsetDateTime other) {605 Objects.instance().assertNotNull(info, actual);606 assertOffsetDateTimeParameterIsNotNull(other);607 if (!areEqualIgnoringTimezone(actual, other)) {608 throw Failures.instance().failure(info, shouldBeEqualIgnoringTimezone(actual, other));609 }610 return myself;611 }612 /**613 * Verifies that actual and given {@link java.time.OffsetDateTime} have same year, month, day, hour and minute fields614 * (second and615 * nanosecond fields are ignored in comparison).616 * <p>617 * Assertion can fail with OffsetDateTimes in same chronological second time window, e.g :618 * <p>619 * 2000-01-01T00:<b>01:00</b>.000+01:00 and 2000-01-01T00:<b>00:59</b>.000+01:00.620 * <p>621 * Assertion fails as minute fields differ even if time difference is only 1s.622 * <p>623 * Code example :624 * <pre><code class='java'> // successful assertions625 * OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 23, 50, 0, 0, ZoneOffset.UTC);626 * OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 23, 50, 10, 456, ZoneOffset.UTC);627 * assertThat(OffsetDateTime1).isEqualToIgnoringSeconds(OffsetDateTime2);628 *629 * // failing assertions (even if time difference is only 1ms)630 * OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 1, 23, 50, 00, 000, ZoneOffset.UTC);631 * OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 23, 49, 59, 999, ZoneOffset.UTC);632 * assertThat(OffsetDateTimeA).isEqualToIgnoringSeconds(OffsetDateTimeB);</code></pre>633 *634 * @param other the given {@link java.time.OffsetDateTime}.635 * @return this assertion object.636 * @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.637 * @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.638 * @throws AssertionError if the actual {@code OffsetDateTime} is are not equal with second and nanosecond fields639 * ignored.640 */641 public SELF isEqualToIgnoringSeconds(OffsetDateTime other) {642 Objects.instance().assertNotNull(info, actual);643 assertOffsetDateTimeParameterIsNotNull(other);644 if (!areEqualIgnoringSeconds(actual, other)) {645 throw Failures.instance().failure(info, shouldBeEqualIgnoringSeconds(actual, other));646 }647 return myself;648 }649 /**650 * Verifies that actual and given {@code OffsetDateTime} have same year, month, day and hour fields (minute, second651 * and652 * nanosecond fields are ignored in comparison).653 * <p>654 * Assertion can fail with OffsetDateTimes in same chronological second time window, e.g :655 * <p>656 * 2000-01-01T<b>01:00</b>:00.000+01:00 and 2000-01-01T<b>00:59:59</b>.000+01:00.657 * <p>658 * Time difference is only 1s but hour fields differ.659 * <p>660 * Code example :661 * <pre><code class='java'> // successful assertions662 * OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 23, 50, 0, 0, ZoneOffset.UTC);663 * OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 23, 00, 2, 7, ZoneOffset.UTC);664 * assertThat(OffsetDateTime1).isEqualToIgnoringMinutes(OffsetDateTime2);665 *666 * // failing assertions (even if time difference is only 1ms)667 * OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 1, 01, 00, 00, 000, ZoneOffset.UTC);668 * OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 00, 59, 59, 999, ZoneOffset.UTC);669 * assertThat(OffsetDateTimeA).isEqualToIgnoringMinutes(OffsetDateTimeB);</code></pre>670 *671 * @param other the given {@link java.time.OffsetDateTime}.672 * @return this assertion object.673 * @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.674 * @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.675 * @throws AssertionError if the actual {@code OffsetDateTime} is are not equal ignoring minute, second and nanosecond676 * fields.677 */678 public SELF isEqualToIgnoringMinutes(OffsetDateTime other) {679 Objects.instance().assertNotNull(info, actual);680 assertOffsetDateTimeParameterIsNotNull(other);681 if (!areEqualIgnoringMinutes(actual, other)) {682 throw Failures.instance().failure(info, shouldBeEqualIgnoringMinutes(actual, other));683 }684 return myself;685 }686 /**687 * Verifies that actual and given {@code OffsetDateTime} have same year, month and day fields (hour, minute, second688 * and nanosecond fields are ignored in comparison).689 * <p>690 * Assertion can fail with OffsetDateTimes in same chronological minute time window, e.g :691 * <p>692 * 2000-01-<b>01T23:59</b>:00.000+01:00 and 2000-01-02T<b>00:00</b>:00.000+01:00.693 * <p>694 * Time difference is only 1min but day fields differ.695 * <p>696 * Code example :697 * <pre><code class='java'> // successful assertions698 * OffsetDateTime OffsetDateTime1 = OffsetDateTime.of(2000, 1, 1, 23, 59, 59, 999, ZoneOffset.UTC);699 * OffsetDateTime OffsetDateTime2 = OffsetDateTime.of(2000, 1, 1, 00, 00, 00, 000, ZoneOffset.UTC);700 * assertThat(OffsetDateTime1).isEqualToIgnoringHours(OffsetDateTime2);701 *702 * // failing assertions (even if time difference is only 1ms)703 * OffsetDateTime OffsetDateTimeA = OffsetDateTime.of(2000, 1, 2, 00, 00, 00, 000, ZoneOffset.UTC);704 * OffsetDateTime OffsetDateTimeB = OffsetDateTime.of(2000, 1, 1, 23, 59, 59, 999, ZoneOffset.UTC);705 * assertThat(OffsetDateTimeA).isEqualToIgnoringHours(OffsetDateTimeB);</code></pre>706 *707 * @param other the given {@link java.time.OffsetDateTime}.708 * @return this assertion object.709 * @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.710 * @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.711 * @throws AssertionError if the actual {@code OffsetDateTime} is are not equal with second and nanosecond fields712 * ignored.713 */714 public SELF isEqualToIgnoringHours(OffsetDateTime other) {715 Objects.instance().assertNotNull(info, actual);716 assertOffsetDateTimeParameterIsNotNull(other);717 if (!haveSameYearMonthAndDayOfMonth(actual, other)) {718 throw Failures.instance().failure(info, shouldBeEqualIgnoringHours(actual, other));719 }720 return myself;721 }722 /**723 * Verifies that the actual {@link OffsetDateTime} is in the [start, end] period (start and end included) according to the comparator in use.724 * <p>725 * <b>Breaking change</b> since 3.15.0 The default comparator uses {@link OffsetDateTime#timeLineOrder()}726 * which only compares the underlying instant and ignores different timezones / offsets / chronologies.<br>727 * This behaviour can be overridden by {@link AbstractOffsetDateTimeAssert#usingComparator(Comparator)}.728 * <p>729 * Example:730 * <pre><code class='java'> OffsetDateTime offsetDateTime = OffsetDateTime.now();731 *732 * // assertions succeed:733 * assertThat(offsetDateTime).isBetween(offsetDateTime.minusSeconds(1), offsetDateTime.plusSeconds(1))734 * .isBetween(offsetDateTime, offsetDateTime.plusSeconds(1))735 * .isBetween(offsetDateTime.minusSeconds(1), offsetDateTime)736 * .isBetween(offsetDateTime, offsetDateTime);737 * // succeeds with default comparator which compares the point in time738 * assertThat(parse("2010-01-01T00:00:00Z")).isBetween(parse("2010-01-01T01:00:00+01:00"),739 * parse("2010-01-01T01:00:00+01:00"));740 *741 * // assertions fail:742 * assertThat(offsetDateTime).isBetween(offsetDateTime.minusSeconds(10), offsetDateTime.minusSeconds(1));743 * assertThat(offsetDateTime).isBetween(offsetDateTime.plusSeconds(1), offsetDateTime.plusSeconds(10));744 *745 * // succeeds with default comparator746 * assertThat(parse("2010-01-01T00:00:00Z")).isBetween(parse("2010-01-01T01:00:00+01:00"),747 * parse("2010-01-01T01:00:00+01:00"));748 * // fails with a comparator which checks the offset, too749 * assertThat(parse("2010-01-01T00:00:00Z")).usingComparator(OffsetDateTime::compareTo)750 * .isBetween(parse("2010-01-01T01:00:00+01:00"),751 * parse("2010-01-01T01:00:00+01:00"));</code></pre>752 *753 * @param startExclusive the start value (exclusive), expected not to be null.754 * @param endExclusive the end value (exclusive), expected not to be null.755 * @return this assertion object.756 * @throws AssertionError if the actual value is {@code null}.757 * @throws NullPointerException if start value is {@code null}.758 * @throws NullPointerException if end value is {@code null}.759 * @throws AssertionError if the actual value is not in [start, end] period according to the comparator in use.760 *761 * @since 3.7.1762 */763 public SELF isBetween(OffsetDateTime startExclusive, OffsetDateTime endExclusive) {764 comparables.assertIsBetween(info, actual, startExclusive, endExclusive, true, true);765 return myself;766 }767 /**768 * Same assertion as {@link #isBetween(OffsetDateTime, OffsetDateTime)} but here you pass {@link OffsetDateTime} String representations769 * which must follow <a href="http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#ISO_OFFSET_DATE_TIME">ISO OffsetDateTime format</a>770 * to allow calling {@link OffsetDateTime#parse(CharSequence)} method.771 * <p>772 * <b>Breaking change</b> since 3.15.0 The default comparator uses {@link OffsetDateTime#timeLineOrder()}773 * which only compares the underlying instant and ignores different timezones / offsets / chronologies.<br>774 * This behaviour can be overridden by {@link AbstractOffsetDateTimeAssert#usingComparator(Comparator)}.775 * <p>776 * Example:777 * <pre><code class='java'> OffsetDateTime firstOfJanuary2000 = OffsetDateTime.parse("2000-01-01T00:00:00Z");778 *779 * // assertions succeed:780 * assertThat(firstOfJanuary2000).isBetween("1999-12-31T23:59:59Z", "2000-01-01T00:00:01Z")781 * .isBetween("2000-01-01T00:00:00Z", "2000-01-01T00:00:01Z")782 * .isBetween("1999-12-31T23:59:59Z", "2000-01-01T00:00:00Z")783 * .isBetween("2000-01-01T00:00:00Z", "2000-01-01T00:00:00Z")784 * // same instant as firstOfJanuary2000 but on a different offset785 * .isBetween("2000-01-01T01:00:00+01:00", "2000-01-01T01:00:00+01:00");786 *787 * // assertion fails:788 * assertThat(firstOfJanuary2000).isBetween("1999-01-01T00:00:01Z", "1999-12-31T23:59:59Z");</code></pre>789 *790 * @param startExclusive the start value (exclusive), expected not to be null.791 * @param endExclusive the end value (exclusive), expected not to be null.792 * @return this assertion object.793 *794 * @throws AssertionError if the actual value is {@code null}.795 * @throws NullPointerException if start value is {@code null}.796 * @throws NullPointerException if end value is {@code null}.797 * @throws DateTimeParseException if any of the given String can't be converted to a {@link OffsetDateTime}.798 * @throws AssertionError if the actual value is not in [start, end] period.799 *800 * @since 3.7.1801 */802 public SELF isBetween(String startExclusive, String endExclusive) {803 return isBetween(parse(startExclusive), parse(endExclusive));804 }805 /**806 * Verifies that the actual {@link OffsetDateTime} is in the ]start, end[ period (start and end excluded) according to807 * the comparator in use.808 * <p>809 * <b>Breaking change</b> since 3.15.0 The default comparator uses {@link OffsetDateTime#timeLineOrder()}810 * which only compares the underlying instant and ignores different timezones / offsets / chronologies.<br>811 * This behaviour can be overridden by {@link AbstractOffsetDateTimeAssert#usingComparator(Comparator)}.812 * <p>813 * Example:814 * <pre><code class='java'> OffsetDateTime offsetDateTime = OffsetDateTime.now();815 *816 * // assertions succeed:817 * assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime.minusSeconds(1), offsetDateTime.plusSeconds(1));818 * // succeeds with a different comparator even though the end value refers to the same instant as the actual819 * assertThat(parse("2010-01-01T12:00:00Z")).usingComparator(OffsetDateTime::compareTo)820 * .isStrictlyBetween(parse("2010-01-01T12:59:59+01:00"),821 * parse("2010-01-01T13:00:00+01:00"));822 *823 * // assertions fail:824 * assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime.minusSeconds(10), offsetDateTime.minusSeconds(1));825 * assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime.plusSeconds(1), offsetDateTime.plusSeconds(10));826 * assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime, offsetDateTime.plusSeconds(1));827 * assertThat(offsetDateTime).isStrictlyBetween(offsetDateTime.minusSeconds(1), offsetDateTime);828 *829 * // fails with default comparator since the end value refers to the same instant as the actual830 * assertThat(parse("2010-01-01T12:00:00Z")).isStrictlyBetween(parse("2010-01-01T12:59:59+01:00"),831 * parse("2010-01-01T13:00:00+01:00"));</code></pre>832 *833 * @param startExclusive the start value (exclusive), expected not to be null.834 * @param endExclusive the end value (exclusive), expected not to be null.835 * @return this assertion object.836 * @throws AssertionError if the actual value is {@code null}.837 * @throws NullPointerException if start value is {@code null}.838 * @throws NullPointerException if end value is {@code null}.839 * @throws AssertionError if the actual value is not in ]start, end[ period according to the comparator in use.840 *841 * @since 3.7.1842 */843 public SELF isStrictlyBetween(OffsetDateTime startExclusive, OffsetDateTime endExclusive) {844 comparables.assertIsBetween(info, actual, startExclusive, endExclusive, false, false);845 return myself;846 }847 /**848 * Same assertion as {@link #isStrictlyBetween(OffsetDateTime, OffsetDateTime)} but here you pass {@link OffsetDateTime} String representations849 * which must follow <a href="http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#ISO_OFFSET_DATE_TIME">ISO OffsetDateTime format</a>850 * to allow calling {@link OffsetDateTime#parse(CharSequence)} method.851 * <p>852 * <b>Breaking change</b> since 3.15.0 The default comparator uses {@link OffsetDateTime#timeLineOrder()}853 * which only compares the underlying instant and ignores different timezones / offsets / chronologies.<br>854 * This behaviour can be overridden by {@link AbstractOffsetDateTimeAssert#usingComparator(Comparator)}.855 * <p>856 * Example:857 * <pre><code class='java'> OffsetDateTime firstOfJanuary2000 = OffsetDateTime.parse("2000-01-01T00:00:00Z");858 *859 * // assertion succeeds:860 * assertThat(firstOfJanuary2000).isStrictlyBetween("1999-12-31T23:59:59Z", "2000-01-01T00:00:01Z")861 * // succeeds with a different comparator even though the end value refers to the same instant as the actual862 * .usingComparator(OffsetDateTime::compareTo)863 * .isStrictlyBetween("1999-12-31T23:59:59Z", "2000-01-01T01:00:00+01:00");864 *865 * // assertions fail:866 * assertThat(firstOfJanuary2000).isStrictlyBetween("1999-01-01T00:00:01Z", "1999-12-31T23:59:59Z");867 * assertThat(firstOfJanuary2000).isStrictlyBetween("2000-01-01T00:00:00Z", "2000-01-01T00:00:01Z");868 * assertThat(firstOfJanuary2000).isStrictlyBetween("1999-12-31T23:59:59Z", "2000-01-01T00:00:00Z");869 * // fails with default comparator since the end value refers to the same instant as the actual870 * assertThat(parse("2010-01-01T12:00:00Z")).isStrictlyBetween("2010-01-01T12:59:59+01:00", "2010-01-01T13:00:00+01:00");</code></pre>871 *872 * @param startExclusive the start value (exclusive), expected not to be null.873 * @param endExclusive the end value (exclusive), expected not to be null.874 * @return this assertion object.875 *876 * @throws AssertionError if the actual value is {@code null}.877 * @throws NullPointerException if start value is {@code null}.878 * @throws NullPointerException if end value is {@code null}.879 * @throws DateTimeParseException if any of the given String can't be converted to a {@link OffsetDateTime}.880 * @throws AssertionError if the actual value is not in ]start, end[ period.881 *882 * @since 3.7.1883 */884 public SELF isStrictlyBetween(String startExclusive, String endExclusive) {885 return isStrictlyBetween(parse(startExclusive), parse(endExclusive));886 }887 /** {@inheritDoc} */888 @Override889 @CheckReturnValue890 public SELF usingDefaultComparator() {891 SELF self = super.usingDefaultComparator();892 self.comparables = buildDefaultComparables();893 return self;894 }895 private Comparables buildDefaultComparables() {896 OffsetDateTimeByInstantComparator defaultComparator = OffsetDateTimeByInstantComparator.getInstance();897 return new Comparables(new ComparatorBasedComparisonStrategy(defaultComparator, defaultComparator.description()));898 }899 /**900 * Verifies that actual and given {@code OffsetDateTime} are at the same {@link java.time.Instant}.901 * <p>902 * Example:903 * <pre><code class='java'> OffsetDateTime offsetDateTime1 = OffsetDateTime.of(2000, 12, 12, 3, 0, 0, 0, ZoneOffset.ofHours(3));904 * OffsetDateTime offsetDateTime2 = OffsetDateTime.of(2000, 12, 12, 0, 0, 0, 0, ZoneOffset.ofHours(0));905 * // assertion succeeds906 * assertThat(offsetDateTime1).isAtSameInstantAs(offsetDateTime2);907 *908 * offsetDateTime2 = OffsetDateTime.of(2000, 12, 12, 2, 0, 0, 0, ZoneOffset.ofHours(0));909 * // assertion fails910 * assertThat(offsetDateTime1).isAtSameInstantAs(offsetDateTime2);</code></pre>911 *912 * @param other the given {@link OffsetDateTime}.913 * @return this assertion object.914 * @throws AssertionError if the actual {@code OffsetDateTime} is {@code null}.915 * @throws IllegalArgumentException if other {@code OffsetDateTime} is {@code null}.916 * @throws AssertionError if the actual {@code OffsetDateTime} is not at the same {@code Instant} as the other.917 */918 public SELF isAtSameInstantAs(OffsetDateTime other) {919 Objects.instance().assertNotNull(info, actual);920 assertOffsetDateTimeParameterIsNotNull(other);921 if (!actual.toInstant().equals(other.toInstant()))922 throw Failures.instance().failure(info, shouldBeAtSameInstant(actual, other));923 return myself;924 }925 /**926 * {@inheritDoc}927 */928 @Override929 protected OffsetDateTime parse(String offsetDateTimeAsString) {930 return OffsetDateTime.parse(offsetDateTimeAsString);931 }932 /**933 * Returns true if both OffsetDateTime are in the same year, month and day of month, hour, minute and second, false934 * otherwise.935 *936 * @param actual the actual OffsetDateTime. expected not be null937 * @param other the other OffsetDateTime. expected not be null938 * @return true if both OffsetDateTime are in the same year, month and day of month, hour, minute and second, false939 * otherwise.940 */941 private static boolean areEqualIgnoringNanos(OffsetDateTime actual, OffsetDateTime other) {942 return areEqualIgnoringSeconds(actual, other) && actual.getSecond() == other.getSecond();943 }944 /**945 * Returns true if both OffsetDateTime are in the same year, month, day of month, hour and minute, false otherwise.946 *947 * @param actual the actual OffsetDateTime. expected not be null948 * @param other the other OffsetDateTime. expected not be null949 * @return true if both OffsetDateTime are in the same year, month, day of month, hour and minute, false otherwise.950 */951 private static boolean areEqualIgnoringSeconds(OffsetDateTime actual, OffsetDateTime other) {952 return areEqualIgnoringMinutes(actual, other) && actual.getMinute() == other.getMinute();953 }954 /**955 * Returns true if both OffsetDateTime are in the same year, month, day of month and hour, false otherwise.956 *957 * @param actual the actual OffsetDateTime. expected not be null958 * @param other the other OffsetDateTime. expected not be null959 * @return true if both OffsetDateTime are in the same year, month, day of month and hour, false otherwise.960 */961 private static boolean areEqualIgnoringMinutes(OffsetDateTime actual, OffsetDateTime other) {962 return haveSameYearMonthAndDayOfMonth(actual, other) && actual.getHour() == other.getHour();963 }964 /**965 * Returns true if both OffsetDateTime are in the same year, month and day of month, false otherwise.966 *967 * @param actual the actual OffsetDateTime. expected not be null968 * @param other the other OffsetDateTime. expected not be null969 * @return true if both OffsetDateTime are in the same year, month and day of month, false otherwise970 */971 private static boolean haveSameYearMonthAndDayOfMonth(OffsetDateTime actual, OffsetDateTime other) {972 return haveSameYearAndMonth(actual, other) && actual.getDayOfMonth() == other.getDayOfMonth();973 }974 /**975 * Returns true if both OffsetDateTime are in the same year and month, false otherwise.976 *977 * @param actual the actual OffsetDateTime. expected not be null978 * @param other the other OffsetDateTime. expected not be null979 * @return true if both OffsetDateTime are in the same year and month, false otherwise980 */981 private static boolean haveSameYearAndMonth(OffsetDateTime actual, OffsetDateTime other) {982 return haveSameYear(actual, other) && actual.getMonth() == other.getMonth();983 }984 /**985 * Returns true if both OffsetDateTime are in the same year, false otherwise.986 *987 * @param actual the actual OffsetDateTime. expected not be null988 * @param other the other OffsetDateTime. expected not be null989 * @return true if both OffsetDateTime are in the same year, false otherwise990 */991 private static boolean haveSameYear(OffsetDateTime actual, OffsetDateTime other) {992 return actual.getYear() == other.getYear();993 }994 /**995 * Returns true if both OffsetDateTime are in the same hour, minute, second and nanosecond false otherwise.996 *997 * @param actual the actual OffsetDateTime. expected not be null998 * @param other the other OffsetDateTime. expected not be null999 * @return true if both OffsetDateTime are in the same hour, minute, second and nanosecond false otherwise.1000 */1001 private static boolean areEqualIgnoringTimezone(OffsetDateTime actual, OffsetDateTime other) {1002 return areEqualIgnoringNanos(actual, other) && haveSameNano(actual, other);1003 }1004 /**1005 * Returns true if both OffsetDateTime are in the same nanosecond, false otherwise.1006 *1007 * @param actual the actual OffsetDateTime. expected not be null1008 * @param other the other OffsetDateTime. expected not be null1009 * @return true if both OffsetDateTime are in the same year, false otherwise1010 */1011 private static boolean haveSameNano(OffsetDateTime actual, OffsetDateTime other) {1012 return actual.getNano() == other.getNano();1013 }1014 private static Object[] convertToOffsetDateTimeArray(String... dateTimesAsString) {1015 OffsetDateTime[] dates = new OffsetDateTime[dateTimesAsString.length];1016 for (int i = 0; i < dateTimesAsString.length; i++) {1017 dates[i] = OffsetDateTime.parse(dateTimesAsString[i]);1018 }1019 return dates;1020 }1021 private void checkIsNotNullAndNotEmpty(Object[] values) {1022 checkArgument(values != null, "The given OffsetDateTime array should not be null");1023 checkArgument(values.length > 0, "The given OffsetDateTime array should not be empty");1024 }1025 /**1026 * Check that the {@link java.time.OffsetDateTime} string representation to compare actual1027 * {@link java.time.OffsetDateTime} to is not null,1028 * otherwise throws a {@link IllegalArgumentException} with an explicit message...

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1import org.junit.jupiter.api.Test;2import org.junit.jupiter.api.extension.ExtendWith;3import org.junit.jupiter.params.ParameterizedTest;4import org.junit.jupiter.params.provider.CsvSource;5import org.junit.jupiter.params.provider.ValueSource;6import org.mockito.InjectMocks;7import org.mockito.Mock;8import org.mockito.junit.jupiter.MockitoExtension;9import org.mockito.junit.jupiter.MockitoSettings;10import org.mockito.quality.Strictness;11import java.time.OffsetDateTime;12import java.time.ZoneOffset;13import java.util.ArrayList;14import java.util.List;15import static org.assertj.core.api.Assertions.assertThat;16import static org.mockito.ArgumentMatchers.any;17import static org.mockito.Mockito.lenient;18import static org.mockito.Mockito.when;19@ExtendWith(MockitoExtension.class)20@MockitoSettings(strictness = Strictness.LENIENT)21public class OffsetDateTimeTest {22 private OffsetDateTimeService offsetDateTimeService;23 private OffsetDateTimeController offsetDateTimeController;24 public void testOffsetDateTime() {25 OffsetDateTime offsetDateTime = OffsetDateTime.of(2019, 12, 12, 12, 12, 12, 12, ZoneOffset.UTC);26 when(offsetDateTimeService.getOffsetDateTime(any(OffsetDateTime.class))).thenReturn(offsetDateTime);27 assertThat(offsetDateTimeController.getOffsetDateTime(offsetDateTime)).isEqualTo(offsetDateTime);28 }29 @ValueSource(strings = { "2019-12-12T12:12:12.012Z", "2019-12-12T12:12:12.012+00:00" })30 public void testOffsetDateTime(String value) {31 OffsetDateTime offsetDateTime = OffsetDateTime.parse(value);32 when(offsetDateTimeService.getOffsetDateTime(any(OffsetDateTime.class))).thenReturn(offsetDateTime);33 assertThat(offsetDateTimeController.getOffsetDateTime(offsetDateTime)).isEqualTo(offsetDateTime);34 }35 @CsvSource({ "2019-12-12T12:12:12.012Z, 2019-12-12T12:12:12.012Z", "2019-12-12T12:12:12.012+00:00, 2019-12-12T12:12:12.012+00:00" })36 public void testOffsetDateTime(String value, String expected) {37 OffsetDateTime offsetDateTime = OffsetDateTime.parse(value);38 OffsetDateTime expectedOffsetDateTime = OffsetDateTime.parse(expected

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1import org.assertj.core.api.Assertions;2import org.junit.Test;3import java.time.OffsetDateTime;4import java.time.ZoneOffset;5public class AbstractOffsetDateTimeAssert_convertToOffsetDateTimeArray_Test {6public void test_convertToOffsetDateTimeArray_assertion() {7 Assertions.assertThat(OffsetDateTime.of(2018, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)).convertToOffsetDateTimeArray().containsExactly(OffsetDateTime.of(2018, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC));8 Assertions.assertThatThrownBy(() -> Assertions.assertThat(OffsetDateTime.of(2018, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)).convertToOffsetDateTimeArray().containsExactly(OffsetDateTime.of(2018, 2, 1, 0, 0, 0, 0, ZoneOffset.UTC))).isInstanceOf(AssertionError.class);9}10}11assertThat(actual).convertToOffsetDateTime();12/** * Verifies that the actual {@code OffsetDateTime} can be converted to an {@code OffsetDateTime} * without any loss of information. * * @return this assertion object. * @throws AssertionError if the actual {@code OffsetDateTime} cannot be converted to an {@code OffsetDateTime} without any loss of information. */ @Override public SELF convertToOffsetDateTime() { return convertToOffsetDateTime(OffsetDateTime.class); }13convertToOffsetDateTime(Class)14convertToOffsetDateTime(ZoneId)15convertToOffsetDateTime(ZoneOffset)16convertToOffsetDateTime(String)17convertToOffsetDateTimeArray(Class)18convertToOffsetDateTimeArray(ZoneId)19convertToOffsetDateTimeArray(ZoneOffset)20convertToOffsetDateTimeArray(String)21convertToOffsetDateTimeArray(Class, ZoneId)22convertToOffsetDateTimeArray(Class, ZoneOffset)23convertToOffsetDateTimeArray(Class, String)24convertToOffsetDateTimeArray(Class, ZoneId, ZoneOffset)25convertToOffsetDateTimeArray(Class, ZoneId, String)26convertToOffsetDateTimeArray(Class, ZoneOffset, String)27convertToOffsetDateTimeArray(Class, ZoneId, ZoneOffset,

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1import static org.assertj.core.api.Assertions.assertThat;2import java.time.OffsetDateTime;3import java.time.ZoneOffset;4import java.util.Arrays;5import java.util.List;6import org.junit.jupiter.api.Test;7public class AbstractOffsetDateTimeAssert_convertToOffsetDateTimeArray_Test {8 public void should_return_array_of_OffsetDateTime() {9 List<String> datesAsString = Arrays.asList("2007-12-03T10:15:30+01:00", "2007-12-03T11:15:30+02:00");10 OffsetDateTime[] dates = assertThat(datesAsString).convertToOffsetDateTimeArray();11 assertThat(dates).containsExactly(OffsetDateTime.of(2007, 12, 3, 10, 15, 30, 0, ZoneOffset.ofHours(1)),12 OffsetDateTime.of(2007, 12, 3, 11, 15, 30, 0, ZoneOffset.ofHours(2)));13 }14}15package org.assertj.core.api.abstractoffsetdatetime;16import static java.time.OffsetDateTime.of;17import static java.time.ZoneOffset.UTC;18import static org.assertj.core.api.Assertions.assertThat;19import static org.assertj.core.api.Assertions.assertThatExceptionOfType;20import static org.assertj.core.util.FailureMessages.actualIsNull;21import java.time.OffsetDateTime;22import org.assertj.core.api.AbstractOffsetDateTimeAssertBaseTest;23import org.junit.jupiter.api.Test;24public class AbstractOffsetDateTimeAssert_isEqualToIgnoringNanos_Test extends AbstractOffsetDateTimeAssertBaseTest {25 private final OffsetDateTime refOffsetDateTime = of(2000, 1, 1, 0, 0, 0, 0, UTC);26 protected AbstractOffsetDateTimeAssert<?> invoke_api_method() {27 return assertions.isEqualToIgnoringNanos(refOffsetDateTime);28 }29 protected void verify_internal_effects() {30 assertThat(getObjects(assertions)).containsExactly(refOffsetDateTime);31 }32 public void should_fail_if_actual_is_null() {33 OffsetDateTime actual = null;34 AssertionError error = assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> assertThat(actual).isEqualToIgnoringNanos(refOffsetDateTime));35 assertThat(error).hasMessage(actualIsNull

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1import java.time.OffsetDateTime;2import java.time.ZoneOffset;3import java.time.ZonedDateTime;4import java.time.format.DateTimeFormatter;5import java.time.format.FormatStyle;6import java.util.Locale;7import org.assertj.core.api.AbstractOffsetDateTimeAssert;8import org.assertj.core.api.Assertions;9public class AbstractOffsetDateTimeAssert_convertToOffsetDateTimeArray {10 public static void main(String[] args) {11 OffsetDateTime offsetDateTime = OffsetDateTime.of(2018, 2, 12, 13, 30, 0, 0, ZoneOffset.UTC);12 ZonedDateTime zonedDateTime = offsetDateTime.toZonedDateTime();13 String dateTimeString = zonedDateTime.format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(Locale.US));14 AbstractOffsetDateTimeAssert<?> assertions = Assertions.assertThat(offsetDateTime);15 OffsetDateTime[] offsetDateTimes = assertions.convertToOffsetDateTimeArray(dateTimeString);16 System.out.println("offsetDateTimes: " + offsetDateTimes);17 }18}

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1import org.junit.Test;2import org.junit.runner.RunWith;3import org.powermock.modules.junit4.PowerMockRunner;4import org.powermock.reflect.Whitebox;5import org.assertj.core.api.AbstractOffsetDateTimeAssert;6import org.assertj.core.api.Assertions;7import java.time.OffsetDateTime;8import java.time.ZoneOffset;9@RunWith(PowerMockRunner.class)10public class AbstractOffsetDateTimeAssert_convertToOffsetDateTimeArray_Test {11 public void test_convertToOffsetDateTimeArray() throws Exception {12 OffsetDateTime[] actual = {OffsetDateTime.of(2000, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC), OffsetDateTime.of(2000, 1, 2, 0, 0, 0, 0, ZoneOffset.UTC)};13 OffsetDateTime[] expected = {OffsetDateTime.of(2000, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC), OffsetDateTime.of(2000, 1, 2, 0, 0, 0, 0, ZoneOffset.UTC)};14 AbstractOffsetDateTimeAssert<?> assertions = Assertions.assertThat(actual);15 OffsetDateTime[] result = Whitebox.invokeMethod(assertions, "convertToOffsetDateTimeArray", actual);16 Assertions.assertThat(result).isEqualTo(expected);17 }18}19 at org.junit.Assert.assertEquals(Assert.java:115)20 at org.junit.Assert.assertEquals(Assert.java:144)21 at org.assertj.core.api.AbstractOffsetDateTimeAssert_convertToOffsetDateTimeArray_Test.test_convertToOffsetDateTimeArray(AbstractOffsetDateTimeAssert_convertToOffsetDateTimeArray_Test.java:24)

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};2assertThat(offsetDateTimeArray).usingFieldByFieldElementComparator()3 .containsExactlyInAnyOrder(convertToOffsetDateTimeArray("2011-01-01T05:00:00Z",4 "2011-01-01T05:00:00+01:00"));5OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};6assertThat(convertToOffsetDateTimeArray("2011-01-01T05:00:00Z",7 "2011-01-01T05:00:00+01:00")).usingFieldByFieldElementComparator()8 .containsExactlyInAnyOrder(offsetDateTimeArray);9OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};10assertThat(convertToOffsetDateTimeArray("2011-01-01T05:00:00Z",11 "2011-01-01T05:00:00+01:00")).usingFieldByFieldElementComparator()12 .containsExactlyInAnyOrder(offsetDateTimeArray);13OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};14assertThat(convertToOffsetDateTimeArray("2011-01-01T05:00:00Z",15 "2011-01-01T05:00:00+01:00")).usingFieldByFieldElementComparator()16 .containsExactlyInAnyOrder(offsetDateTimeArray);17OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};18assertThat(convertToOffsetDateTimeArray("2011-01-01T05:00:00Z",19 "2011-01-01T05:00:00+01:00")).usingFieldByFieldElementComparator()20 .containsExactlyInAnyOrder(offsetDateTimeArray);

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1import java.time.OffsetDateTime;2import java.time.ZoneOffset;3import java.time.ZonedDateTime;4import java.time.format.DateTimeFormatter;5import org.assertj.core.api.Assertions;6import org.junit.jupiter.api.Test;7class OffsetDateTimeTest {8 public void test() {9 OffsetDateTime[] offsetDateTimes = new OffsetDateTime[]{10 OffsetDateTime.of(2018, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC),11 OffsetDateTime.of(2018, 1, 2, 0, 0, 0, 0, ZoneOffset.UTC),12 OffsetDateTime.of(2018, 1, 3, 0, 0, 0, 0, ZoneOffset.UTC),13 OffsetDateTime.of(2018, 1, 4, 0, 0, 0, 0, ZoneOffset.UTC),14 OffsetDateTime.of(2018, 1, 5, 0, 0, 0, 0, ZoneOffset.UTC),15 OffsetDateTime.of(2018, 1, 6, 0, 0, 0, 0, ZoneOffset.UTC),16 OffsetDateTime.of(2018, 1, 7, 0, 0, 0, 0, ZoneOffset.UTC)17 };18 ZonedDateTime[] zonedDateTimes = convertToZonedDateTimeArray(offsetDateTimes);19 Assertions.assertThat(zonedDateTimes).containsExactly(20 ZonedDateTime.of(2018, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC),21 ZonedDateTime.of(2018, 1, 2, 0, 0, 0, 0, ZoneOffset.UTC),22 ZonedDateTime.of(2018, 1, 3, 0, 0, 0, 0, ZoneOffset.UTC),23 ZonedDateTime.of(2018, 1, 4, 0, 0, 0, 0, ZoneOffset.UTC),24 ZonedDateTime.of(2018, 1, 5, 0, 0, 0, 0, ZoneOffset.UTC),25 ZonedDateTime.of(2018, 1, 6, 0, 0, 0, 0, ZoneOffset

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();2assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");3assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();4assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");5assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();6assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");7assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();8assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");9assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();10assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");11assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();12assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");13assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();14assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");15assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();16assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");17assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();18assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");19assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();20assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray("yyyy-MM-dd");21assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();22assertThat(offsetDateTime

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};2assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray(new String[]{"yyyy-MM-dd", "yyyy-MM-dd"});3OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};4assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray(new String[]{"yyyy-MM-dd", "yyyy-MM-dd"});5OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};6assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray(new String[]{"yyyy-MM-dd", "yyyy-MM-dd"}, ZoneId.systemDefault());7OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};8assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray(new String[]{"yyyy-MM-dd", "yyyy-MM-dd"}, ZoneId.systemDefault(), OffsetDateTime.now().getOffset());9OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};10assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray(new String[]{"yyyy-MM-dd", "yyyy-MM-dd"}, ZoneId.systemDefault(), OffsetDateTime.now().getOffset(), OffsetDateTime.now());11OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[]{OffsetDateTime.now(), OffsetDateTime.now().plusDays(1)};12assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray(new String[]{"yyyy-MM-dd", "yyyy-MM-dd"}, ZoneId.systemDefault(), OffsetDateTime.now().getOffset(), OffsetDateTime.now(), DateTimeFormatter.ISO_DATE_TIME);

Full Screen

Full Screen

convertToOffsetDateTimeArray

Using AI Code Generation

copy

Full Screen

1OffsetDateTime[] offsetDateTimeArray = new OffsetDateTime[] { OffsetDateTime.now(), OffsetDateTime.now() };2OffsetDateTime[][] offsetDateTimeArrayArray = assertThat(offsetDateTimeArray).convertToOffsetDateTimeArray();3assertThat(offsetDateTimeArrayArray).hasSize(2);4assertThat(offsetDateTimeArrayArray).containsExactly(new OffsetDateTime[] { OffsetDateTime.now(), OffsetDateTime.now() });5OffsetDateTime[][] offsetDateTimeArrayArray = new OffsetDateTime[][] { new OffsetDateTime[] { OffsetDateTime.now(), OffsetDateTime.now() }, new OffsetDateTime[] { OffsetDateTime.now(), OffsetDateTime.now() } };6assertThat(offsetDateTimeArrayArray).hasSize(2);7assertThat(offsetDateTimeArrayArray).containsExactly(new OffsetDateTime[] { OffsetDateTime.now(), OffsetDateTime.now() }, new OffsetDateTime[] { OffsetDateTime.now(), OffsetDateTime.now() });8List<List<OffsetDateTime>> offsetDateTimeListList = new ArrayList<List<OffsetDateTime>>();9List<OffsetDateTime> offsetDateTimeList = new ArrayList<OffsetDateTime>();10offsetDateTimeList.add(OffsetDateTime.now());11offsetDateTimeList.add(OffsetDateTime.now());12offsetDateTimeListList.add(offsetDateTimeList);13offsetDateTimeList = new ArrayList<OffsetDateTime>();14offsetDateTimeList.add(OffsetDateTime.now());15offsetDateTimeList.add(OffsetDateTime.now());16offsetDateTimeListList.add(offsetDateTimeList);17assertThat(offsetDateTimeListList).hasSize(2);18assertThat(offsetDateTimeListList).containsExactly(new ArrayList<OffsetDateTime>() { { add(OffsetDateTime.now()); add(OffsetDateTime.now()); } }, new ArrayList<OffsetDateTime>() { { add(OffsetDateTime.now()); add(OffsetDateTime.now()); } });19List<OffsetDateTime[]> offsetDateTimeArrayList = new ArrayList<OffsetDateTime[]>();20offsetDateTimeArrayList.add(new OffsetDateTime[] { OffsetDateTime.now(), OffsetDateTime.now() });21offsetDateTimeArrayList.add(new OffsetDateTime[] { OffsetDateTime.now(), OffsetDateTime.now() });

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