2020-02-05 19:05:49 -08:00
|
|
|
package utils;
|
|
|
|
|
2022-06-06 15:39:44 -05:00
|
|
|
import org.testng.annotations.Test;
|
2020-02-05 19:05:49 -08:00
|
|
|
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
|
|
public class SearchUtilTest {
|
|
|
|
@Test
|
|
|
|
public void testEscapeForwardSlash() {
|
|
|
|
// escape "/"
|
|
|
|
assertEquals("\\\\/foo\\\\/bar", SearchUtil.escapeForwardSlash("/foo/bar"));
|
|
|
|
// "/" is escaped but "*" is not escaped and is treated as regex. Since currently we want to retain the regex behaviour with "*"
|
|
|
|
assertEquals("\\\\/foo\\\\/bar\\\\/*", SearchUtil.escapeForwardSlash("/foo/bar/*"));
|
|
|
|
assertEquals("", "");
|
|
|
|
assertEquals("foo", "foo");
|
|
|
|
}
|
|
|
|
}
|