public DirectoryAssert hasSameContentAs(Path path) { FileAssert fileAssert = new FileAssert(actual.toFile()); fileAssert.exists().isDirectory(); Arrays .stream(path.toFile().listFiles()) .map(File::toPath) .forEach(expectedFile -> { Path actualFile = actual.resolve(expectedFile.getFileName()); if (expectedFile.toFile().isDirectory()) { assertThatDirectory(actualFile).hasSameContentAs(expectedFile); } else { Assertions.assertThat(actualFile).exists().isRegularFile().hasSameContentAs(expectedFile); } }); return this; }
private void containsEffectivePom(String effectivePom) { final String smartTestingExtension = "org.arquillian.smart.testing"; final File targetDirectory = actual.getTargetDirectory(); Path reportPath = Paths.get(targetDirectory.toString(), SMART_TESTING_TARGET_DIRECTORY_NAME, REPORTING_SUBDIRECTORY); if (targetDirectory.exists() && !actual.getModel().getPackaging().equals("pom")) { final File pomFile = new File(reportPath.toString(), effectivePom); FileAssert fileAssert = new FileAssert(pomFile); fileAssert.exists(); Assertions.assertThat(contentOf(pomFile)).contains(smartTestingExtension); } }
private void hasReportFile(String report) { final File targetDirectory = actual.getTargetDirectory(); Path reportPath = Paths.get(targetDirectory.toString(), SMART_TESTING_TARGET_DIRECTORY_NAME, REPORTING_SUBDIRECTORY); final FileAssert fileAssert = new FileAssert(new File(reportPath.toString(), report)); if (isJar(actual)) { if (hasCompiledTests(targetDirectory)) { fileAssert.exists(); } else { fileAssert.doesNotExist(); } } else { fileAssert.doesNotExist(); } }
@Override protected FileAssert invoke_api_method() { return assertions.hasParent(parent); }
@Override protected FileAssert invoke_api_method() { return assertions.hasExtension(extension); }
@Override protected FileAssert invoke_api_method() { return assertions.doesNotExist(); }
@Override protected FileAssert invoke_api_method() { return assertions.usingCharset(otherCharset); }
@Override protected FileAssert invoke_api_method() { return assertions.exists(); }
@Override protected FileAssert invoke_api_method() { return assertions.isFile(); }
@Override protected FileAssert invoke_api_method() { return assertions.isAbsolute(); }
@Override protected FileAssert invoke_api_method() { // not used here return null; }
@Override protected FileAssert invoke_api_method() { return assertions.hasParent((String) null); }
@Override protected FileAssert invoke_api_method() { return assertions.canWrite(); }
@Override protected FileAssert invoke_api_method() { return assertions.hasSameContentAs(expected); }
@Override protected FileAssert invoke_api_method() { return assertions.hasNoParent(); }
@Override protected FileAssert invoke_api_method() { return assertions.isDirectory(); }
@Override protected FileAssert invoke_api_method() { return assertions.isRelative(); }
@Override protected FileAssert invoke_api_method() { return assertions.hasContent(expected); }
@Override protected FileAssert invoke_api_method() { // do nothing return assertions; }
@Override protected FileAssert invoke_api_method() { return assertions.usingCharset(otherCharset.name()); }
@Override protected FileAssert invoke_api_method() { return assertions.hasName(expected); }
@Override protected FileAssert invoke_api_method() { return assertions.hasBinaryContent(content); }
@Override protected FileAssert invoke_api_method() { return assertions.canRead(); }