/**
  * This method is responsible for adding the {@link OutputData} element to the existing file. This
  * method determines the right position of the test record based on the id attribute {@link
  * TestRecord#getId()} of the {@link TestRecord}.
  *
  * @param inputTestData an Object representation of the XML data
  * @param actualData the data structure that contains the output data that needs to be written to
  *     the file. The output data is identified by the key {@link Loader#ACTUAL_RESULT}
  */
 private void updateTestMethods(
     InputTestData inputTestData, Map<String, List<Map<String, Object>>> actualData) {
   for (String methodName : actualData.keySet()) {
     List<Map<String, Object>> testRecords = actualData.get(methodName);
     for (Map<String, Object> testRecord : testRecords) {
       Boolean outputDataAdded = false;
       if (testRecord.containsKey(ACTUAL_RESULT)) {
         // The data needs to be written to the XML file.
         // Find the right place to put the data.
         for (TestMethod testMethod : inputTestData.getTestMethod()) {
           List<TestRecord> originalTestRecords = testMethod.getTestRecord();
           for (TestRecord originalTestRecord : originalTestRecords) {
             if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
               OutputData outputData = new OutputData();
               Entry outputEntry = new Entry();
               outputEntry.setKey(ACTUAL_RESULT);
               outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
               outputData.getEntry().add(outputEntry);
               originalTestRecord.setOutputData(outputData);
               outputDataAdded = true;
               break;
             }
           }
           if (outputDataAdded) {
             break;
           }
         }
       }
     }
   }
 }
 /**
  * Convert the data from {@link InputTestData} to a Map representation as understood by the
  * EasyTest Framework
  *
  * @param source an instance of {@link InputTestData}
  * @param destination an instance of {@link Map}
  */
 private void convertFromInputTestData(
     InputTestData source, Map<String, List<Map<String, Object>>> destination) {
   List<TestMethod> testMethods = source.getTestMethod();
   for (TestMethod method : testMethods) {
     List<Map<String, Object>> testMethodData =
         convertFromLIstOfTestRecords(method.getTestRecord());
     destination.put(method.getName(), testMethodData);
   }
 }