From 669506e499cd4a6dd177a4627d57100f46f32a4c Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Thu, 30 Jan 2025 19:21:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20YearQuarter#max=20?= =?UTF-8?q?=E5=92=8C=20YearQuarter#min=EF=BC=8C=E4=BD=BF=E7=94=A8=20guava?= =?UTF-8?q?=20=E7=9A=84=20Comparators#max=20=E5=92=8C=20Comparators#min=20?= =?UTF-8?q?=E5=8D=B3=E5=8F=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plusone/commons/time/YearQuarter.java | 10 +--------- .../plusone/commons/time/YearQuarterTests.java | 17 +---------------- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/main/java/xyz/zhouxy/plusone/commons/time/YearQuarter.java b/src/main/java/xyz/zhouxy/plusone/commons/time/YearQuarter.java index 947b065..dfaf3c6 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/time/YearQuarter.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/time/YearQuarter.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 the original author or authors. + * Copyright 2024-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -281,14 +281,6 @@ public final class YearQuarter implements Comparable, Serializable return this.compareTo(other) > 0; } - public static YearQuarter min(YearQuarter yearQuarter1, YearQuarter yearQuarter2) { - return yearQuarter1.compareTo(yearQuarter2) <= 0 ? yearQuarter1 : yearQuarter2; - } - - public static YearQuarter max(YearQuarter yearQuarter1, YearQuarter yearQuarter2) { - return yearQuarter1.compareTo(yearQuarter2) >= 0 ? yearQuarter1 : yearQuarter2; - } - // #endregion // #region - toString diff --git a/src/test/java/xyz/zhouxy/plusone/commons/time/YearQuarterTests.java b/src/test/java/xyz/zhouxy/plusone/commons/time/YearQuarterTests.java index fcb14a6..70e4c7e 100644 --- a/src/test/java/xyz/zhouxy/plusone/commons/time/YearQuarterTests.java +++ b/src/test/java/xyz/zhouxy/plusone/commons/time/YearQuarterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 the original author or authors. + * Copyright 2024-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1173,19 +1173,4 @@ public class YearQuarterTests { } } } - - @ParameterizedTest - @ValueSource(ints = { -1, 0, 1, 1900, 2000, 2023, 2024, Year.MAX_VALUE, Year.MIN_VALUE }) - void test_min_And_max_sameYear(int year) { - YearQuarter yq1 = YearQuarter.of(year, 1); - YearQuarter anotherYq1 = YearQuarter.of(year, 1); - - assertEquals(yq1, YearQuarter.max(yq1, anotherYq1)); - assertEquals(yq1, YearQuarter.min(yq1, anotherYq1)); - - YearQuarter yq2 = YearQuarter.of(year, 2); - assertEquals(yq2, YearQuarter.max(yq1, yq2)); - assertEquals(yq1, YearQuarter.min(yq1, yq2)); - - } }