private static File createDefaultSUT() throws Exception { File sutDirectory = new File(JSystemProperties.getCurrentTestsPath(), "sut"); JSystemProperties.getInstance().setPreference(FrameworkOptions.USED_SUT_FILE, "default.xml"); File defaultSut = new File(sutDirectory, "default.xml"); if (!defaultSut.exists()) { FileUtils.write(defaultSut, "<sut/>", false); } return defaultSut; }
public File getSutDirectory() { String sutDir = JSystemProperties.getInstance().getPreference(FrameworkOptions.SUT_DIR); if (sutDir != null && !(sutDir = sutDir.trim()).isEmpty()) { File sd = new File(sutDir); sd = new File(System.getProperty("user.dir") + File.separator + sutDir); if (sd.exists() && sd.isDirectory()) { return sd; } else { log.log(Level.WARNING, "SUT directory: " + sutDir + " couldn't be found"); } } final File testsPath = new File(JSystemProperties.getCurrentTestsPath()); if (testsPath.getName().equals("test-classes")) { // ITAI: We are running from Eclipse project with Maven structure. return new File(testsPath.getParentFile() + File.separator + "classes", "sut"); } return new File(testsPath, "sut"); }