mihaibudiu commented on code in PR #4833:
URL: https://github.com/apache/calcite/pull/4833#discussion_r2926025224
##########
core/src/test/java/org/apache/calcite/util/UtilTest.java:
##########
@@ -241,6 +241,45 @@ class UtilTest {
assertThatScientific("-0.0", is("-0.0E0"));
}
+ @Test void testRightPad() {
+ assertThat(Util.rightPad("a", 1, 'x'), is("a"));
+ assertThat(Util.rightPad("a", 2, 'x'), is("ax"));
+ assertThat(Util.rightPad("a", 4, 'x'), is("axxx"));
+ assertThat(Util.rightPad("", 3, 'x'), is("xxx"));
+ }
+
+ @Test void testJoinNullable() {
+ final List<@Nullable Object> parts = Arrays.asList("a", null, "b");
+ assertThat(Util.joinNullable(parts, ":"), is("a::b"));
+ assertThat(Util.joinNullable(Collections.emptyList(), ","), is(""));
+ assertThat(Util.joinNullable(Arrays.asList(null, null), ":"), is(":"));
+ }
+
+ @Test void testReplaceChars() {
+ assertNull(Util.replaceChars((String) null, "ab", "x"));
+ assertThat(Util.replaceChars("", "ab", "x"), is(""));
+
+ final String s = new StringBuilder().append("abc").toString();
Review Comment:
why use a builder here and below?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]