Skip to content

Commit 80d6ce4

Browse files
authored
Merge pull request ESAPI#415 from xeno6696/develop
Issue ESAPI#281 -- Updated unit tests with missing assertions.
2 parents 92734ea + 3ed0a2f commit 80d6ce4

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/test/java/org/owasp/esapi/reference/SafeFileTest.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,17 @@ public void testEscapeCharactersInFilename() {
8080
}
8181

8282
File sf = new File(testDir, "test^.file" );
83-
if ( sf.exists() ) {
84-
System.out.println( " Injection allowed "+ sf.getAbsolutePath() );
85-
} else {
86-
System.out.println( " Injection didn't work "+ sf.getAbsolutePath() );
87-
}
83+
assertFalse("Injection didn't work " + sf.getAbsolutePath(),
84+
sf.exists());
85+
assertTrue(" Injection allowed " + sf.getAbsolutePath(), sf.exists());
8886
}
8987

9088
public void testEscapeCharacterInDirectoryInjection() {
9189
System.out.println("testEscapeCharacterInDirectoryInjection");
9290
File sf = new File(testDir, "test\\^.^.\\file");
93-
if ( sf.exists() ) {
94-
System.out.println( " Injection allowed "+ sf.getAbsolutePath() );
95-
} else {
96-
System.out.println( " Injection didn't work "+ sf.getAbsolutePath() );
97-
}
91+
assertFalse(" Injection didn't work " + sf.getAbsolutePath(),
92+
sf.exists());
93+
assertTrue(" Injection allowed " + sf.getAbsolutePath(), sf.exists());
9894
}
9995

10096
public void testJavaFileInjectionGood() throws ValidationException
@@ -275,5 +271,4 @@ public void testCreateParentPercentNull()
275271
// expected
276272
}
277273
}
278-
279274
}

0 commit comments

Comments
 (0)