@Test
public void abortTest() throws IOException, URISyntaxException, ExecutionException, InterruptedException {

    File appFolder = new File(getClass().getResource("/test-app-2").toURI());
    File transformedAppFolder = Files.createTempDir();
    FileUtils.copyDirectory(appFolder, transformedAppFolder);
    System.out.printf("Transformed sample app folder: %s\n", transformedAppFolder.getAbsolutePath());
    Application application = new ApplicationImpl(transformedAppFolder);
    Configuration configuration = new ConfigurationImpl(null);
    TransformationTemplate transformationTemplate = new JavaEEToSpringBoot();
    AbstractTransformationRequest transformation = new TemplateTransformationRequest(application, transformationTemplate, configuration);
    TransformationResult transformationResult = transformationEngine.perform(transformation).get();
    assertNotNull(transformationResult);
    assertFalse(transformationResult.isSuccessful());
    assertEquals(transformationResult.getTransformationRequest().getConfiguration(), configuration);
    assertFalse(transformationResult.hasManualInstructions());
    assertNull(transformationResult.getManualInstructionsFile());
    assertEquals(transformationResult.getTransformedApplicationDir(), transformedAppFolder);
    assertNotNull(transformationResult.getAbortDetails());
    List<TransformationMetrics> metricsList = transformationResult.getMetrics();
    assertNotNull(metricsList);
    assertEquals(metricsList.size(), 1);
    TransformationMetrics metrics = metricsList.get(0);
    assertNull(metrics.getFromVersion());
    assertNull(metrics.getToVersion());
    TransformationStatistics statistics = metrics.getStatistics();
    assertEquals(statistics.getTUExecutionResultValueCount(), 1);
    assertEquals(statistics.getManualInstructionsCount(), 0);
    assertEquals(statistics.getPerformResultErrorCount(), 0);
    assertEquals(statistics.getPerformResultSkippedConditionCount(), 0);
    assertEquals(statistics.getPerformResultSkippedDependencyCount(), 0);
    assertEquals(statistics.getTOExecutionResultErrorCount(), 0);
    assertEquals(statistics.getTOExecutionResultWarningCount(), 0);
    assertEquals(statistics.getTUExecutionResultErrorCount(), 1);
    assertEquals(statistics.getTUExecutionResultWarningCount(), 0);
    AbortDetails abortDetails = transformationResult.getAbortDetails();
    assertTrue(abortDetails.toString().startsWith("{\n" +
            "  \"templateName\": \"ButterflySpringBootExtension:JavaEEToSpringBoot\",\n" +
            "  \"templateClassName\": \"com.paypal.butterfly.extensions.springboot.JavaEEToSpringBoot\",\n" +
            "  \"utilityName\": \"ButterflySpringBootExtension:JavaEEToSpringBoot-2-Abort\",\n" +
            "  \"utilityClassName\": \"com.paypal.butterfly.extensions.api.utilities.Abort\",\n" +
            "  \"abortMessage\": \"This application does not have a root pom.xml file\",\n" +
            "  \"exceptionClassName\": \"com.paypal.butterfly.extensions.api.exception.TransformationUtilityException\",\n" +
            "  \"exceptionMessage\": \"Abort transformation utility has been executed\",\n" +
            "  \"exceptionStackTrace\": \"com.paypal.butterfly.extensions.api.exception.TransformationUtilityException: Abort transformation utility has been executed"));
    assertEquals(abortDetails.getTemplateName(), ButterflySpringBootExtension.class.getSimpleName() + ":" + JavaEEToSpringBoot.class.getSimpleName());
    assertEquals(abortDetails.getTemplateClassName(), JavaEEToSpringBoot.class.getName());
    assertEquals(abortDetails.getUtilityName(), "ButterflySpringBootExtension:JavaEEToSpringBoot-2-Abort");
    assertEquals(abortDetails.getUtilityClassName(), Abort.class.getName());
    assertEquals(abortDetails.getAbortMessage(), "This application does not have a root pom.xml file");
    assertEquals(abortDetails.getExceptionClassName(), TransformationUtilityException.class.getName());
    assertEquals(abortDetails.getExceptionMessage(), "Abort transformation utility has been executed");
    assertNotNull(abortDetails.getExceptionStackTrace());
    assertTrue(abortDetails.getExceptionStackTrace().startsWith(TransformationUtilityException.class.getName() + ": Abort transformation utility has been executed\n\tat " + Abort.class.getName() + ".execution("));
}