2 * Svjatoslav Commons - shared library of common functionality. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
5 package eu.svjatoslav.commons.string;
9 import static org.junit.Assert.fail;
11 public class GlobMatcherTest {
14 private static void testWildcard(final String string, final String pattern,
15 final boolean expectedResult) {
17 final boolean result = GlobMatcher.match(string, pattern);
19 if (result != expectedResult)
20 fail("Wildcard match failed.");
27 testWildcard("IMG_9770.JPG", "*.J*", true);
28 testWildcard("1", "1", true);
29 testWildcard("1", "*", true);
30 testWildcard("f", "1", false);
31 testWildcard("Hello !", "Hell*!***", true);
32 testWildcard("Hello !", "Hell*!", true);
33 testWildcard("Hello !", "Hell*", true);
34 testWildcard("Hello !", "Hell", false);
35 testWildcard("Hello !", "* *", true);