From b6256e8eedecdef726b94abb069e5a16def106e0 Mon Sep 17 00:00:00 2001 From: javasabr Date: Thu, 15 Jan 2026 18:04:15 +0100 Subject: [PATCH 1/7] extends API for StringUtils and Enums --- README.md | 2 +- build.gradle | 2 +- .../javasabr/rlib/common/AliasedEnum.java | 8 +++ .../rlib/common/util/AliasedEnumMap.java | 52 +++++++++++++++ .../rlib/common/util/StringUtils.java | 37 ++++++++++- .../rlib/common/util/AliasedEnumMapTest.java | 63 +++++++++++++++++++ .../rlib/common/util/StringUtilsTest.java | 56 ++++++++++++++++- 7 files changed, 213 insertions(+), 7 deletions(-) create mode 100644 rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java create mode 100644 rlib-common/src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java create mode 100644 rlib-common/src/test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java diff --git a/README.md b/README.md index 28fc0ea0..ac110b90 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ repositories { } ext { - rlibVersion = "10.0.alpha9" + rlibVersion = "10.0.alpha10" } dependencies { diff --git a/build.gradle b/build.gradle index a8d68183..3aa53416 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -rootProject.version = "10.0.alpha9" +rootProject.version = "10.0.alpha10" group = 'javasabr.rlib' allprojects { diff --git a/rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java b/rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java new file mode 100644 index 00000000..c30679c4 --- /dev/null +++ b/rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java @@ -0,0 +1,8 @@ +package javasabr.rlib.common; + +import java.util.Collection; + +public interface AliasedEnum> { + + Collection aliases(); +} diff --git a/rlib-common/src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java b/rlib-common/src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java new file mode 100644 index 00000000..04db88fe --- /dev/null +++ b/rlib-common/src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java @@ -0,0 +1,52 @@ +package javasabr.rlib.common.util; + +import java.util.HashMap; +import java.util.Map; +import javasabr.rlib.common.AliasedEnum; +import lombok.AccessLevel; +import lombok.CustomLog; +import lombok.experimental.FieldDefaults; +import org.jspecify.annotations.Nullable; + +@CustomLog +@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true) +public class AliasedEnumMap & AliasedEnum> { + + Map aliasToValue; + + public AliasedEnumMap(Class enumClass) { + var enumConstants = enumClass.getEnumConstants(); + var aliasToValue = new HashMap(); + + for (T enumConstant : enumConstants) { + for (String alias : enumConstant.aliases()) { + T previous = aliasToValue.put(alias, enumConstant); + if (previous != null) { + throw new IllegalArgumentException("Detect duplicated alias:[%s] for [%s] and [%s]".formatted( + alias, + previous.name(), + enumConstant.name())); + } + } + } + this.aliasToValue = Map.copyOf(aliasToValue); + } + + @Nullable + public T resolve(String alias) { + return aliasToValue.get(alias); + } + + public T resolve(String alias, T def) { + T resolved = resolve(alias); + return resolved == null ? def : resolved; + } + + public T require(String alias) { + T constant = resolve(alias); + if (constant == null) { + throw new IllegalArgumentException("Unknown enum constant for alias:[%s]".formatted(alias)); + } + return constant; + } +} diff --git a/rlib-common/src/main/java/javasabr/rlib/common/util/StringUtils.java b/rlib-common/src/main/java/javasabr/rlib/common/util/StringUtils.java index 056aa754..3c2bcfbc 100644 --- a/rlib-common/src/main/java/javasabr/rlib/common/util/StringUtils.java +++ b/rlib-common/src/main/java/javasabr/rlib/common/util/StringUtils.java @@ -37,16 +37,27 @@ public static String emptyIfNull(@Nullable String string) { } /** - * Return the another string if the received string is empty. + * Return the another string if the received string is empty or null. * * @param string the string. * @param another the another string. - * @return the another string if the received string is empty. + * @return the another string if the received string is empty or null. */ public static String ifEmpty(@Nullable String string, String another) { return isEmpty(string) ? another : string; } + /** + * Return the another string if the received string is blank or null. + * + * @param string the string. + * @param another the another string. + * @return the another string if the received string is blank or null. + */ + public static String ifBlank(@Nullable String string, String another) { + return isBlank(string) ? another : string; + } + /** * Check a string email. * @@ -212,7 +223,7 @@ private static MessageDigest getHashMD5() { } /** - * Returns true if the string empty or null. + * Returns true if the string is empty or null. * * @param string the string. * @return true if the string is null or empty. @@ -221,6 +232,16 @@ public static boolean isEmpty(@Nullable String string) { return string == null || string.isEmpty(); } + /** + * Returns true if the string is blank or null. + * + * @param string the string. + * @return true if the string is null or blank. + */ + public static boolean isBlank(@Nullable String string) { + return string == null || string.isBlank(); + } + /** * Returns true if the string isn't empty. * @@ -231,6 +252,16 @@ public static boolean isNotEmpty(@Nullable String string) { return !isEmpty(string); } + /** + * Returns true if the string isn't blank. + * + * @param string the string. + * @return true if the string isn't blank. + */ + public static boolean isNotBlank(@Nullable String string) { + return !isBlank(string); + } + /** * Gets the length of the string. * diff --git a/rlib-common/src/test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java b/rlib-common/src/test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java new file mode 100644 index 00000000..f02855b9 --- /dev/null +++ b/rlib-common/src/test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java @@ -0,0 +1,63 @@ +package javasabr.rlib.common.util; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.util.Collection; +import java.util.List; +import java.util.Set; +import javasabr.rlib.common.AliasedEnum; +import org.jspecify.annotations.NonNull; +import org.junit.jupiter.api.Test; + +class AliasedEnumMapTest { + + public enum TestEnum implements AliasedEnum<@NonNull TestEnum> { + CONSTANT1(Set.of("cnst1", "constant1", "CONSTANT1")), + CONSTANT2(Set.of("cnst2", "constant2", "CONSTANT2")), + CONSTANT3(Set.of("cnst3", "constant3", "CONSTANT3")), + CONSTANT4(Set.of("cnst4", "constant4", "CONSTANT4")), + CONSTANT5(Set.of("cnst5", "constant5", "CONSTANT5")); + + private static final AliasedEnumMap MAP = new AliasedEnumMap<>(TestEnum.class); + + private final Collection aliases; + + TestEnum(Collection aliases) { + this.aliases = aliases; + } + + @Override + public Collection aliases() { + return aliases; + } + } + + @Test + void shouldResolveEnumByAlias() { + // when\then: + assertThat(TestEnum.MAP.resolve("cnst1")).isEqualTo(TestEnum.CONSTANT1); + assertThat(TestEnum.MAP.resolve("constant1")).isEqualTo(TestEnum.CONSTANT1); + assertThat(TestEnum.MAP.resolve("CONSTANT1")).isEqualTo(TestEnum.CONSTANT1); + assertThat(TestEnum.MAP.resolve("cnst2")).isEqualTo(TestEnum.CONSTANT2); + assertThat(TestEnum.MAP.resolve("CONSTANT2")).isEqualTo(TestEnum.CONSTANT2); + assertThat(TestEnum.MAP.resolve("constant3")).isEqualTo(TestEnum.CONSTANT3); + assertThat(TestEnum.MAP.resolve("CONSTANT4")).isEqualTo(TestEnum.CONSTANT4); + assertThat(TestEnum.MAP.resolve("unkonwn")).isNull(); + assertThat(TestEnum.MAP.resolve("")).isNull(); + assertThat(TestEnum.MAP.resolve("unknown", TestEnum.CONSTANT4)).isEqualTo(TestEnum.CONSTANT4); + } + + @Test + void shouldRequireEnumByAlias() { + // when\then: + assertThat(TestEnum.MAP.require("cnst1")).isEqualTo(TestEnum.CONSTANT1); + assertThat(TestEnum.MAP.require("CONSTANT2")).isEqualTo(TestEnum.CONSTANT2); + assertThat(TestEnum.MAP.require("cnst3")).isEqualTo(TestEnum.CONSTANT3); + assertThat(TestEnum.MAP.require("constant4")).isEqualTo(TestEnum.CONSTANT4); + assertThatThrownBy(() -> TestEnum.MAP.require("unknown")) + .isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> TestEnum.MAP.require("")) + .isInstanceOf(IllegalArgumentException.class); + } +} diff --git a/rlib-common/src/test/java/javasabr/rlib/common/util/StringUtilsTest.java b/rlib-common/src/test/java/javasabr/rlib/common/util/StringUtilsTest.java index 803d2808..e9447179 100644 --- a/rlib-common/src/test/java/javasabr/rlib/common/util/StringUtilsTest.java +++ b/rlib-common/src/test/java/javasabr/rlib/common/util/StringUtilsTest.java @@ -103,7 +103,6 @@ void shouldThrownIllegalArgumentExceptionDuringReplacingStringWithWrongArgs() { @Test void shouldVerifyEmails() { - Assertions.assertTrue(StringUtils.isValidEmail("test@test.com")); Assertions.assertTrue(StringUtils.isValidEmail("тест@test.com")); Assertions.assertTrue(StringUtils.isValidEmail("тест@тест.рф")); @@ -116,7 +115,6 @@ void shouldVerifyEmails() { @Test void shouldDetectEmails() { - Assertions.assertTrue(StringUtils.isEmail("test@test.com")); Assertions.assertTrue(StringUtils.isEmail("test.test@test.com")); Assertions.assertTrue(StringUtils.isEmail("test.test@test.test.com")); @@ -126,4 +124,58 @@ void shouldDetectEmails() { Assertions.assertFalse(StringUtils.isEmail("test@test")); Assertions.assertFalse(StringUtils.isEmail("test@test.")); } + + @Test + void shouldCheckIfStringIsEmpty() { + Assertions.assertTrue(StringUtils.isEmpty(null)); + Assertions.assertFalse(StringUtils.isNotEmpty(null)); + + Assertions.assertTrue(StringUtils.isEmpty("")); + Assertions.assertFalse(StringUtils.isNotEmpty("")); + + Assertions.assertFalse(StringUtils.isEmpty(" ")); + Assertions.assertTrue(StringUtils.isNotEmpty(" ")); + + Assertions.assertFalse(StringUtils.isEmpty("123")); + Assertions.assertTrue(StringUtils.isNotEmpty("123")); + } + + @Test + void shouldReturnAnotherStringIfEmpty() { + Assertions.assertEquals("alt", StringUtils.ifEmpty(null, "alt")); + Assertions.assertEquals("alt", StringUtils.ifEmpty("", "alt")); + Assertions.assertEquals(" ", StringUtils.ifEmpty(" ", "alt")); + Assertions.assertEquals("123", StringUtils.ifEmpty("123", "alt")); + } + + @Test + void shouldCheckIfStringIsBlank() { + Assertions.assertTrue(StringUtils.isBlank(null)); + Assertions.assertFalse(StringUtils.isNotBlank(null)); + + Assertions.assertTrue(StringUtils.isBlank("")); + Assertions.assertFalse(StringUtils.isNotBlank("")); + + Assertions.assertTrue(StringUtils.isBlank(" ")); + Assertions.assertFalse(StringUtils.isNotBlank(" ")); + + Assertions.assertTrue(StringUtils.isBlank(" ")); + Assertions.assertFalse(StringUtils.isNotBlank(" ")); + + Assertions.assertFalse(StringUtils.isBlank(" 1")); + Assertions.assertTrue(StringUtils.isNotBlank(" 1")); + + Assertions.assertFalse(StringUtils.isBlank("123")); + Assertions.assertTrue(StringUtils.isNotBlank("123")); + } + + @Test + void shouldReturnAnotherStringIfBlank() { + Assertions.assertEquals("alt", StringUtils.ifBlank(null, "alt")); + Assertions.assertEquals("alt", StringUtils.ifBlank("", "alt")); + Assertions.assertEquals("alt", StringUtils.ifBlank(" ", "alt")); + Assertions.assertEquals("alt", StringUtils.ifBlank(" ", "alt")); + Assertions.assertEquals(" 1", StringUtils.ifBlank(" 1", "alt")); + Assertions.assertEquals("123", StringUtils.ifBlank("123", "alt")); + } } From df796633a6d4843f99a9189e016cd2f93b52e48c Mon Sep 17 00:00:00 2001 From: javasabr Date: Sat, 17 Jan 2026 10:14:42 +0100 Subject: [PATCH 2/7] add sort method to arrays --- .../rlib/collections/array/MutableArray.java | 5 +++ .../array/impl/AbstractMutableArray.java | 26 ++++++++++++++++ .../array/impl/CopyOnWriteMutableArray.java | 27 ++++++++++++++++ .../collections/array/MutableArrayTest.java | 31 +++++++++++++++++++ 4 files changed, 89 insertions(+) diff --git a/rlib-collections/src/main/java/javasabr/rlib/collections/array/MutableArray.java b/rlib-collections/src/main/java/javasabr/rlib/collections/array/MutableArray.java index 5571222a..66d3d1c0 100644 --- a/rlib-collections/src/main/java/javasabr/rlib/collections/array/MutableArray.java +++ b/rlib-collections/src/main/java/javasabr/rlib/collections/array/MutableArray.java @@ -1,6 +1,7 @@ package javasabr.rlib.collections.array; import java.util.Collection; +import java.util.Comparator; import java.util.Iterator; import java.util.function.Consumer; import java.util.function.IntFunction; @@ -48,4 +49,8 @@ default void forEach(Consumer action) { @Override UnsafeMutableArray asUnsafe(); + + void sort(); + + void sort(Comparator comparator); } diff --git a/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/AbstractMutableArray.java b/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/AbstractMutableArray.java index 4975352c..1c8b2acd 100644 --- a/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/AbstractMutableArray.java +++ b/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/AbstractMutableArray.java @@ -2,6 +2,7 @@ import java.util.Arrays; import java.util.Collection; +import java.util.Comparator; import java.util.Iterator; import java.util.Objects; import java.util.Spliterator; @@ -10,6 +11,7 @@ import java.util.stream.StreamSupport; import javasabr.rlib.collections.array.Array; import javasabr.rlib.collections.array.UnsafeMutableArray; +import javasabr.rlib.common.util.ObjectUtils; import lombok.AccessLevel; import lombok.experimental.FieldDefaults; import org.jspecify.annotations.Nullable; @@ -226,6 +228,30 @@ public UnsafeMutableArray asUnsafe() { return this; } + @Override + + public void sort() { + sortInternalArray(wrapped(), size()); + } + + @SuppressWarnings({ + "rawtypes", + "unchecked" + }) + protected void sortInternalArray(@Nullable E[] array, int size) { + if (Comparable.class.isAssignableFrom(type())) { + Comparable[] wrapped = (Comparable[]) array; + Arrays.sort(wrapped, 0, size, Comparator.naturalOrder()); + } else { + Arrays.sort(array, 0, size, Comparator.comparingInt(ObjectUtils::hash)); + } + } + + @Override + public void sort(Comparator comparator) { + Arrays.sort(wrapped(), 0, size(), comparator); + } + protected static void validateCapacity(int capacity) { if (capacity < 0) { throw new IllegalArgumentException("Capacity cannot be negative"); diff --git a/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/CopyOnWriteMutableArray.java b/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/CopyOnWriteMutableArray.java index 35857c4f..906bb2de 100644 --- a/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/CopyOnWriteMutableArray.java +++ b/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/CopyOnWriteMutableArray.java @@ -2,6 +2,7 @@ import java.util.Arrays; import java.util.Collection; +import java.util.Comparator; import java.util.ConcurrentModificationException; import java.util.concurrent.atomic.AtomicReference; import javasabr.rlib.collections.array.Array; @@ -208,4 +209,30 @@ protected int getAndIncrementSize() { protected int decrementAnGetSize() { return 0; } + + @Override + public void sort() { + for (int i = 0; i < LIMIT_ATTEMPTS; i++) { + @Nullable E[] original = wrapped.get(); + @Nullable E[] copy = Arrays.copyOf(original, original.length); + sortInternalArray(copy, copy.length); + if (wrapped.compareAndSet(original, copy)) { + return; + } + } + throw new ConcurrentModificationException("Cannot successfully sort this array"); + } + + @Override + public void sort(Comparator comparator) { + for (int i = 0; i < LIMIT_ATTEMPTS; i++) { + @Nullable E[] original = wrapped.get(); + @Nullable E[] copy = Arrays.copyOf(original, original.length); + Arrays.sort(copy, comparator); + if (wrapped.compareAndSet(original, copy)) { + return; + } + } + throw new ConcurrentModificationException("Cannot successfully sort this array"); + } } diff --git a/rlib-collections/src/test/java/javasabr/rlib/collections/array/MutableArrayTest.java b/rlib-collections/src/test/java/javasabr/rlib/collections/array/MutableArrayTest.java index e6611468..28a9b85c 100644 --- a/rlib-collections/src/test/java/javasabr/rlib/collections/array/MutableArrayTest.java +++ b/rlib-collections/src/test/java/javasabr/rlib/collections/array/MutableArrayTest.java @@ -1,5 +1,6 @@ package javasabr.rlib.collections.array; +import java.util.Comparator; import java.util.List; import java.util.stream.Stream; import org.junit.jupiter.api.Assertions; @@ -253,6 +254,36 @@ void shouldRenderToStringCorrectly(MutableArray mutableArray) { mutableArray.toString()); } + @ParameterizedTest + @MethodSource("generateMutableArrays") + @DisplayName("should sort array correctly") + void shouldSortArrayCorrectly(MutableArray mutableArray) { + // given: + mutableArray.addAll(Array.of("10", "99", "5", "3", "77", "45", "25", "56")); + + // when: + mutableArray.sort(); + + // then: + var expected = Array.of("10", "25", "3", "45", "5", "56", "77", "99"); + Assertions.assertEquals(expected, mutableArray); + } + + @ParameterizedTest + @MethodSource("generateMutableArrays") + @DisplayName("should sort array correctly") + void shouldSortArrayUsingComparatorCorrectly(MutableArray mutableArray) { + // given: + mutableArray.addAll(Array.of("10", "99", "5", "3", "77", "45", "25", "56")); + + // when: + mutableArray.sort(Comparator.comparingInt(Integer::parseInt)); + + // then: + var expected = Array.of("3", "5", "10", "25", "45", "56", "77", "99"); + Assertions.assertEquals(expected, mutableArray); + } + private static Stream generateMutableArrays() { return Stream.of( Arguments.of(ArrayFactory.mutableArray(String.class)), From 5d68f414b98327fdb90b32ea920614888447cb6e Mon Sep 17 00:00:00 2001 From: Aliaksandr Brui Date: Sat, 17 Jan 2026 17:47:57 +0100 Subject: [PATCH 3/7] Update rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../javasabr/rlib/common/AliasedEnum.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java b/rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java index c30679c4..683e7770 100644 --- a/rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java +++ b/rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java @@ -2,7 +2,30 @@ import java.util.Collection; +/** + * Marks an {@link Enum} whose constants expose one or more string aliases. + *

+ * Implementing enums can provide alternative string representations for each constant, + * which can be used, for example, for parsing user input, configuration values, + * or external identifiers that do not necessarily match the constant {@code name()}. + * + * @param the concrete enum type implementing this interface + */ public interface AliasedEnum> { + /** + * Returns the string aliases associated with this enum constant. + *

+ * An alias is an alternative textual identifier for the constant, such as a + * short name, legacy name, or external code, that can be used for lookup + * or serialization instead of the enum's {@link Enum#name()}. + *

+ * Implementations should never return {@code null}; an empty collection + * indicates that the constant has no aliases. Callers should not modify + * the returned collection unless the implementation explicitly documents + * that it is mutable. + * + * @return a non-{@code null} collection of aliases for this constant + */ Collection aliases(); } From 0f6aa3ffca20b24c4ad4f580ad6569a34d819b08 Mon Sep 17 00:00:00 2001 From: Aliaksandr Brui Date: Sat, 17 Jan 2026 17:48:12 +0100 Subject: [PATCH 4/7] Update rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/AbstractMutableArray.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../rlib/collections/array/impl/AbstractMutableArray.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/AbstractMutableArray.java b/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/AbstractMutableArray.java index 1c8b2acd..7c57d1be 100644 --- a/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/AbstractMutableArray.java +++ b/rlib-collections/src/main/java/javasabr/rlib/collections/array/impl/AbstractMutableArray.java @@ -243,7 +243,8 @@ protected void sortInternalArray(@Nullable E[] array, int size) { Comparable[] wrapped = (Comparable[]) array; Arrays.sort(wrapped, 0, size, Comparator.naturalOrder()); } else { - Arrays.sort(array, 0, size, Comparator.comparingInt(ObjectUtils::hash)); + throw new IllegalStateException( + "Cannot sort array of non-Comparable elements without an explicit comparator"); } } From ae780a29b3f654f04457649e1ea3a188021735c6 Mon Sep 17 00:00:00 2001 From: Aliaksandr Brui Date: Sat, 17 Jan 2026 17:48:33 +0100 Subject: [PATCH 5/7] Update rlib-common/src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rlib-common/src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java b/rlib-common/src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java index 04db88fe..4e18da6d 100644 --- a/rlib-common/src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java +++ b/rlib-common/src/main/java/javasabr/rlib/common/util/AliasedEnumMap.java @@ -22,7 +22,7 @@ public AliasedEnumMap(Class enumClass) { for (String alias : enumConstant.aliases()) { T previous = aliasToValue.put(alias, enumConstant); if (previous != null) { - throw new IllegalArgumentException("Detect duplicated alias:[%s] for [%s] and [%s]".formatted( + throw new IllegalArgumentException("Detected duplicated alias:[%s] for [%s] and [%s]".formatted( alias, previous.name(), enumConstant.name())); From f76a366852879079e578324d287afeb6e6ddfd02 Mon Sep 17 00:00:00 2001 From: Aliaksandr Brui Date: Sat, 17 Jan 2026 17:48:43 +0100 Subject: [PATCH 6/7] Update rlib-common/src/test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rlib-common/src/test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java b/rlib-common/src/test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java index f02855b9..458c73ce 100644 --- a/rlib-common/src/test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java +++ b/rlib-common/src/test/java/javasabr/rlib/common/util/AliasedEnumMapTest.java @@ -43,7 +43,7 @@ void shouldResolveEnumByAlias() { assertThat(TestEnum.MAP.resolve("CONSTANT2")).isEqualTo(TestEnum.CONSTANT2); assertThat(TestEnum.MAP.resolve("constant3")).isEqualTo(TestEnum.CONSTANT3); assertThat(TestEnum.MAP.resolve("CONSTANT4")).isEqualTo(TestEnum.CONSTANT4); - assertThat(TestEnum.MAP.resolve("unkonwn")).isNull(); + assertThat(TestEnum.MAP.resolve("unknown")).isNull(); assertThat(TestEnum.MAP.resolve("")).isNull(); assertThat(TestEnum.MAP.resolve("unknown", TestEnum.CONSTANT4)).isEqualTo(TestEnum.CONSTANT4); } From e4325efce85e40de73ffff20bb925996aacf04ae Mon Sep 17 00:00:00 2001 From: Aliaksandr Brui Date: Sat, 17 Jan 2026 17:48:51 +0100 Subject: [PATCH 7/7] Update rlib-collections/src/test/java/javasabr/rlib/collections/array/MutableArrayTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../java/javasabr/rlib/collections/array/MutableArrayTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rlib-collections/src/test/java/javasabr/rlib/collections/array/MutableArrayTest.java b/rlib-collections/src/test/java/javasabr/rlib/collections/array/MutableArrayTest.java index 28a9b85c..fa2cd74c 100644 --- a/rlib-collections/src/test/java/javasabr/rlib/collections/array/MutableArrayTest.java +++ b/rlib-collections/src/test/java/javasabr/rlib/collections/array/MutableArrayTest.java @@ -271,7 +271,7 @@ void shouldSortArrayCorrectly(MutableArray mutableArray) { @ParameterizedTest @MethodSource("generateMutableArrays") - @DisplayName("should sort array correctly") + @DisplayName("should sort array using comparator correctly") void shouldSortArrayUsingComparatorCorrectly(MutableArray mutableArray) { // given: mutableArray.addAll(Array.of("10", "99", "5", "3", "77", "45", "25", "56"));