| 
									
										
										
										
											2020-02-05 19:05:49 -08:00
										 |  |  | package utils;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-08 20:27:51 -06:00
										 |  |  | import static org.junit.jupiter.api.Assertions.assertEquals;
 | 
					
						
							| 
									
										
										
										
											2020-02-05 19:05:49 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-06 11:02:42 +05:30
										 |  |  | import org.junit.jupiter.api.Test;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-05 19:05:49 -08:00
										 |  |  | public class SearchUtilTest {
 | 
					
						
							| 
									
										
										
										
											2023-12-06 11:02:42 +05:30
										 |  |  |   @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");
 | 
					
						
							|  |  |  |   }
 | 
					
						
							| 
									
										
										
										
											2020-02-05 19:05:49 -08:00
										 |  |  | }
 |