ahgittin commented on code in PR #1372:
URL: https://github.com/apache/brooklyn-server/pull/1372#discussion_r1034857327


##########
core/src/test/java/org/apache/brooklyn/util/core/file/ArchiveUtilsTest.java:
##########
@@ -110,7 +112,31 @@ public void testDeployExplicitDestFile() throws Exception {
         ArchiveUtils.deploy(origJar.getAbsolutePath(), machine, 
destDir.getAbsolutePath(), destFile);
         assertFilesEqual(new File(destDir, destFile), origJar);
     }
-    
+    @Test(groups="Integration", expectedExceptions = 
IllegalStateException.class)
+    public void testUnzipFileAccessingPathOutsideTargetFolderEvilWinFormat() 
throws Exception{

Review Comment:
   I'd probably refactor these to a `doTestUnzip(url)` method.
   
   i also prefer catching exceptions in the test body and asserting based on 
them, rather than part of the test annotation which is too easy to overlook and 
doesn't test as much as we might like.  eg
   
   `Asserts.assertFailsWith(() -> doTestUnzip(url), e -> { 
Asserts.expectedExceptionContainsIgnoreCase(e, "outside"); return true; })`
   
   Lastly we should probably do a `finally { tempZipFile.delete() }`, eg in 
case tests are interrupted.
   
   but all comments are minor.  good tests, and good to merge without 
addressing these comments.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brooklyn.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to