This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push: new 3d539247b Update EqualsBuilderReflectJreImplementationTest for Period 3d539247b is described below commit 3d539247bdc473cb2258e16a50a12314e7c97f91 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu Dec 5 17:58:40 2024 -0500 Update EqualsBuilderReflectJreImplementationTest for Period --- .../EqualsBuilderReflectJreImplementationTest.java | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderReflectJreImplementationTest.java b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderReflectJreImplementationTest.java index 919379856..8cab8bba6 100644 --- a/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderReflectJreImplementationTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/EqualsBuilderReflectJreImplementationTest.java @@ -22,6 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.time.Duration; import java.time.Instant; +import java.time.Period; import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAmount; @@ -98,15 +99,17 @@ public class EqualsBuilderReflectJreImplementationTest extends AbstractLangTest static class MyTemporal implements Temporal { private final String string; - private final long value; - private final Instant instant; + private final int value; private final Duration duration; + private final Instant instant; + private final Period period; MyTemporal(final String string) { this.string = string; - this.value = Long.parseLong(string); + this.value = Integer.parseInt(string); this.instant = Instant.ofEpochMilli(value); this.duration = Duration.between(instant, instant.plusMillis(value)); + this.period = Period.ofDays(value); } @Override @@ -131,7 +134,7 @@ public class EqualsBuilderReflectJreImplementationTest extends AbstractLangTest @Override public String toString() { - return String.format("%s[%s - %s - %s]", getClass().getSimpleName(), string, instant, duration); + return String.format("%s[%s - %s - %s]", getClass().getSimpleName(), string, instant, duration, period); } @Override @@ -148,15 +151,18 @@ public class EqualsBuilderReflectJreImplementationTest extends AbstractLangTest static class MyTemporalAccessor implements TemporalAccessor { private final String string; - private final long value; + private final int value; private final Instant instant; private final Duration duration; + private final Period period; MyTemporalAccessor(final String string) { this.string = string; - this.value = Long.parseLong(string); + this.value = Integer.parseInt(string); this.instant = Instant.ofEpochMilli(value); this.duration = Duration.between(instant, instant.plusMillis(value)); + this.period = Period.ofDays(value); + } @Override @@ -171,7 +177,7 @@ public class EqualsBuilderReflectJreImplementationTest extends AbstractLangTest @Override public String toString() { - return String.format("%s[%s - %s - %s]", getClass().getSimpleName(), string, instant, duration); + return String.format("%s[%s - %s - % - %s]", getClass().getSimpleName(), string, instant, duration, period); } } @@ -179,15 +185,17 @@ public class EqualsBuilderReflectJreImplementationTest extends AbstractLangTest static class MyTemporalAmount implements TemporalAmount { private final String string; - private final long value; + private final int value; private final Instant instant; private final Duration duration; + private final Period period; MyTemporalAmount(final String string) { this.string = string; - this.value = Long.parseLong(string); + this.value = Integer.parseInt(string); this.instant = Instant.ofEpochMilli(value); this.duration = Duration.between(instant, instant.plusMillis(value)); + this.period = Period.ofDays(value); } @Override @@ -212,7 +220,7 @@ public class EqualsBuilderReflectJreImplementationTest extends AbstractLangTest @Override public String toString() { - return String.format("%s[%s - %s - %s]", getClass().getSimpleName(), string, instant, duration); + return String.format("%s[%s - %s - %s - %s]", getClass().getSimpleName(), string, instant, duration, period); }