mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-27 00:40:06 +00:00 
			
		
		
		
	
		
			
	
	
		
			18 lines
		
	
	
		
			569 B
		
	
	
	
		
			Java
		
	
	
	
	
	
		
		
			
		
	
	
			18 lines
		
	
	
		
			569 B
		
	
	
	
		
			Java
		
	
	
	
	
	
|   | package utils;
 | ||
|  | 
 | ||
|  | import org.junit.Test;
 | ||
|  | 
 | ||
|  | 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");
 | ||
|  |     }
 | ||
|  | }
 |