77import org .junit .jupiter .api .Assertions ;
88import org .junit .jupiter .api .Test ;
99
10- class FileUtilitiesTest {
10+ class FileSecurityUtilsTest {
1111
1212 @ Test
1313 void isFileInDir_outside_successfullyWithResult () throws IOException {
1414 Path sourcePath = Paths .get ("src" ).toAbsolutePath ();
1515 Path cwd = Paths .get ("" ).toAbsolutePath ();
1616
17- boolean isOutside = FileUtilities .isFileOutsideDir (cwd .toString (), sourcePath .toString ());
17+ boolean isOutside = FileSecurityUtils .isFileOutsideDir (cwd .toString (), sourcePath .toString ());
1818 Assertions .assertTrue (isOutside );
1919 }
2020
@@ -23,35 +23,35 @@ void isFileInDir_inside_successfullyWithResult() throws IOException {
2323 Path sourcePath = Paths .get ("src" ).toAbsolutePath ();
2424 Path cwd = Paths .get ("" ).toAbsolutePath ();
2525
26- boolean isOutside = FileUtilities .isFileOutsideDir (sourcePath .toString (), cwd .toString ());
26+ boolean isOutside = FileSecurityUtils .isFileOutsideDir (sourcePath .toString (), cwd .toString ());
2727 Assertions .assertFalse (isOutside );
2828 }
2929
3030 @ Test
3131 void isFileInDir_null_successfully () {
3232 Assertions .assertThrows (
33- NullPointerException .class , () -> FileUtilities .isFileOutsideDir (null , null ));
33+ NullPointerException .class , () -> FileSecurityUtils .isFileOutsideDir (null , null ));
3434
3535 Assertions .assertThrows (
3636 NullPointerException .class ,
37- () -> FileUtilities .isFileOutsideDir ("file-path-place-holder" , null ));
37+ () -> FileSecurityUtils .isFileOutsideDir ("file-path-place-holder" , null ));
3838
3939 Assertions .assertThrows (
4040 NullPointerException .class ,
41- () -> FileUtilities .isFileOutsideDir (null , "base-dir-place-holder" ));
41+ () -> FileSecurityUtils .isFileOutsideDir (null , "base-dir-place-holder" ));
4242 }
4343
4444 @ Test
45- void normalize_validInput_successfullyWithResult () throws IOException {
45+ void normalize_validInput_successfullyWithResult () {
4646 String validInput = "./In/../Valid/Un/../Normalized/./Path" ;
4747 String expectedResult = "Valid" + File .separator + "Normalized" + File .separator + "Path" ;
4848
49- String actualResult = FileUtilities .normalize (validInput );
49+ String actualResult = FileSecurityUtils .normalize (validInput );
5050 Assertions .assertEquals (expectedResult , actualResult );
5151 }
5252
5353 @ Test
5454 void normalize_null_successfully () {
55- Assertions .assertNull (FileUtilities .normalize (null ));
55+ Assertions .assertNull (FileSecurityUtils .normalize (null ));
5656 }
5757}
0 commit comments