/** * Method that determines the right Loader and the right Data Files for the "write output data" * functionality supported by the EasyTest Framework. * * @param testData an instance of {@link DataLoader} that helps in identifying the right {@link * Loader} to write the data back to the file. * @param testClass the class that the {@link TestInfo} object will be associated with * @return {@link TestInfo} an instance of {@link TestInfo} containing information about the * currently executing test. */ public static TestInfo determineLoader(DataLoader testData, TestClass testClass) { TestInfo result = new TestInfo(testClass); // String[] dataFiles = testData.filePaths(); String[] dataFiles = determineFilePaths(testData); LoaderType loaderType = determineLoaderType(testData, dataFiles); // Loader Loader dataLoader = null; if (LoaderType.CUSTOM.equals(loaderType) || dataFiles.length == 0) { dataLoader = getCustomLoaderInstance(testData); } else { // user has specified data files and the data fileType is also // not custom. if (loaderType != null) { dataLoader = LoaderFactory.getLoader(loaderType); } } result.setDataLoader(dataLoader); result.setFilePaths(dataFiles); result.setWriteData(testData.writeData()); return result; }