elharo opened a new issue, #210:
URL: https://github.com/apache/maven-script-interpreter/issues/210

   ### Affected version
   
   HEAD
   
   ### Bug description
   
   Needs to fail in the try block and move assertions into catch block
   
   ```
       @Test
       void beanshellReturnedNotTrueShouldThrowException() throws Exception {
           File logFile = new File(tempDir, "build.log");
   
           TestMirrorHandler mirrorHandler = new TestMirrorHandler();
   
           ScriptReturnException catchedException = null;
   
           try (FileLogger fileLogger = new FileLogger(logFile, mirrorHandler);
                   ScriptRunner scriptRunner = new ScriptRunner()) {
               scriptRunner.run("test", new 
File("src/test/resources/bsh-test"), "return-not-true", null, fileLogger);
           } catch (ScriptReturnException e) {
               catchedException = e;
           }
   
           assertEquals("Not true value", catchedException.getResult());
           assertEquals("The test returned Not true value.", 
catchedException.getMessage());
           String logContent = new String(Files.readAllBytes(logFile.toPath()));
           assertTrue(logContent.contains(new 
File("src/test/resources/bsh-test/return-not-true.bsh").getPath()));
           assertEquals(logContent, mirrorHandler.getLoggedMessage());
       }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to