Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/6263#discussion_r201291422
  
    --- Diff: 
flink-clients/src/test/java/org/apache/flink/client/program/PackagedProgramTest.java
 ---
    @@ -56,6 +63,54 @@ public void testGetPreviewPlan() {
                }
        }
     
    +   /**
    +    * The test for {@link PackagedProgram#extractContainedLibraries}.
    +    * As a prerequisite the test generates a jar file with the following 
structure
    +    * test.jar
    +    * |- lib
    +    * |--|- internalTest.jar
    +    */
    +   @Test
    +   public void testExtractContainedLibraries() {
    +           String s = "testExtractContainedLibraries";
    +           Path workDir = null;
    +           Path fakeJar = null;
    +           try {
    +                   workDir = 
Files.createTempDirectory(PackagedProgram.class.getSimpleName() + "_");
    +                   fakeJar = 
Paths.get(workDir.toAbsolutePath().toString(), "test.jar");
    +                   FileOutputStream fos = new 
FileOutputStream(fakeJar.toFile());
    +                   try (ZipOutputStream zos = new ZipOutputStream(fos)) {
    +                           ZipEntry entry = new 
ZipEntry("lib/internalTest.jar");
    +                           zos.putNextEntry(entry);
    +                           zos.write(s.getBytes());
    +                           zos.closeEntry();
    +                   } catch (IOException e) {
    +                           System.err.println(e.getMessage());
    +                           e.printStackTrace();
    +                           Assert.fail("Test is erroneous: " + 
e.getMessage());
    +                   }
    +                   
PackagedProgram.extractContainedLibraries(fakeJar.toUri().toURL());
    +           }
    +           catch (Exception e) {
    --- End diff --
    
    no need to catch them, just let them bubble up


---

Reply via email to