List of usage examples for org.apache.commons.lang3.mutable MutableInt decrement
public void decrement()
From source file:org.zaproxy.VerifyScripts.java
private static void readFiles() throws Exception { Optional<String> path = Arrays.stream(System.getProperty("java.class.path").split(File.pathSeparator)) .filter(e -> e.endsWith("/scripts")).findFirst(); assertThat(path).as("The scripts directory was not found on the classpath.").isPresent(); List<Path> unexpectedFiles = new ArrayList<>(); MutableInt depth = new MutableInt(); files = new ArrayList<>(); Files.walkFileTree(Paths.get(path.get()), new SimpleFileVisitor<Path>() { @Override//from ww w . jav a 2 s . c o m public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { depth.increment(); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { if (depth.intValue() != SCRIPT_TYPE_DIR_DEPTH) { unexpectedFiles.add(file); return FileVisitResult.CONTINUE; } if (!isExpectedNonScriptFile(file)) { files.add(file); } return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { depth.decrement(); return FileVisitResult.CONTINUE; } }); assertThat(unexpectedFiles).as("Files found not in a script type directory.").isEmpty(); Collections.sort(files); }