CompareXMLFiles extends DoubleCondition<CompareXMLFiles> { @Override protected TUExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { return super.execution(transformedAppFolder, transformationContext); } CompareXMLFiles();  CompareXMLFiles(String attribute); @Override String getDescription();  }
@Test public void compareXMLEqualDifferentFilesTest2() { Mockito.when(transformationContext.get("ATR")).thenReturn(new File(transformedAppFolder, "/src/main/resources/file1.xml")); CompareXMLFiles compareXML = new CompareXMLFiles().setAttribute("ATR").relative("/src/main/resources/file2.xml"); TUExecutionResult executionResult = compareXML.execution(transformedAppFolder, transformationContext); Assert.assertEquals(executionResult.getType(), TUExecutionResult.Type.VALUE); Assert.assertTrue((Boolean) executionResult.getValue()); }
@Test public void compareXMLInexistentFilesTest() { CompareXMLFiles compareXML; TUExecutionResult executionResult; Mockito.when(transformationContext.get("ATR")).thenReturn(new File(transformedAppFolder, "/src/main/resources/inexistent_file.xml")); compareXML = new CompareXMLFiles().setAttribute("ATR").relative("pom.xml"); executionResult = compareXML.execution(transformedAppFolder, transformationContext); Assert.assertEquals(executionResult.getType(), TUExecutionResult.Type.VALUE); Assert.assertFalse((Boolean) executionResult.getValue()); Mockito.when(transformationContext.get("ATR")).thenReturn(new File(transformedAppFolder, "/src/main/resources/inexistent_file.xml")); compareXML = new CompareXMLFiles().setAttribute("ATR").relative("/src/main/resources/another_inexistent_file.yaml"); executionResult = compareXML.execution(transformedAppFolder, transformationContext); Assert.assertEquals(executionResult.getType(), TUExecutionResult.Type.VALUE); Assert.assertTrue((Boolean) executionResult.getValue()); Mockito.when(transformationContext.get("ATR")).thenReturn(new File(transformedAppFolder, "pom.xml")); compareXML = new CompareXMLFiles().setAttribute("ATR").relative("/src/main/resources/another_inexistent_file.xml"); executionResult = compareXML.execution(transformedAppFolder, transformationContext); Assert.assertEquals(executionResult.getType(), TUExecutionResult.Type.VALUE); Assert.assertFalse((Boolean) executionResult.getValue()); }