KAFKA-16923 New Unit Test for stripDotPathComponents method (#16259)

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
Arnav Dadarya 2024-06-20 10:02:10 -07:00 committed by GitHub
parent 7b23976e78
commit 6aa8f3c119
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -34,4 +34,18 @@ public class CommandUtilsTest {
assertEquals(Arrays.asList("alpha", "beta"),
CommandUtils.splitPath("//alpha/beta/"));
}
@Test
public void testStripDotPathComponents() {
//double dots
assertEquals(Arrays.asList("keep", "keep2"), CommandUtils.stripDotPathComponents(Arrays.asList("..", "keep", "keep2")));
//single dots
assertEquals(Arrays.asList("keep", "keep2"), CommandUtils.stripDotPathComponents(Arrays.asList(".", "keep", "keep2")));
assertEquals(Arrays.asList(".keep", "keep2"), CommandUtils.stripDotPathComponents(Arrays.asList(".", ".keep", "keep2")));
assertEquals(Arrays.asList(".keep", "keep2"), CommandUtils.stripDotPathComponents(Arrays.asList("..", ".keep", "keep2")));
}
}