WatchAndRestartMachine implements Runnable { public static boolean checkIfWouldBeExcluded(Set<String> patterns, String string) { return !matchRule(null, patterns, string).proceed; } WatchAndRestartMachine(
            Path directoryToRecursivelyWatch,
            Set<String> includes,
            Set<String> excludes,
            DelayedRestartTrigger restartTrigger);  WatchAndRestartMachine(
            Set<Path> directoriesToRecursivelyWatch,
            Set<String> includes,
            Set<String> excludes,
            DelayedRestartTrigger restartTrigger); void shutdown(); @Override void run(); void handleNewOrModifiedFile(String newOrMod, Path path); static RuleMatch matchRule(Set<String> includes, Set<String> excludes, String string); static boolean checkIfWouldBeExcluded(Set<String> patterns, String string);  }
@Test public void testCheckIfMatchesPatternAndAssetsAreIgnored() { Set<String> patterns = new HashSet<>(Arrays.asList(DEFAULT_EXCLUDE_PATTERNS)); assertThat( WatchAndRestartMachine.checkIfWouldBeExcluded( patterns, "target" + File.separator + "classes" + File.separator + "assets" + File.separator + "js" + File.separator + "script.js"), is(true)); assertThat( WatchAndRestartMachine.checkIfWouldBeExcluded( patterns, File.separator + "assets" + File.separator), is(true)); }
@Test public void testCheckIfMatchesPatternMachtesOfOtherStuff() { Set<String> patterns = new HashSet<>(Arrays.asList(DEFAULT_EXCLUDE_PATTERNS)); assertThat( WatchAndRestartMachine.checkIfWouldBeExcluded( patterns, "target" + File.separator + "classes" + File.separator + "completelyDifferentPath"), is(false)); }
@Test public void testCheckIfMatchesPatternAndFtlHtmlFilesAreIgnored() { Set<String> patterns = new HashSet<>(Arrays.asList(DEFAULT_EXCLUDE_PATTERNS)); assertThat( WatchAndRestartMachine.checkIfWouldBeExcluded( patterns, "target" + File.separator + "classes" + File.separator + "views" + File.separator + "ApplicationController" + File.separator + "index.ftl.html"), is(true)); assertThat( WatchAndRestartMachine.checkIfWouldBeExcluded( patterns, "target" + File.separator + "classes" + File.separator + "views" + File.separator + "ApplicationController" + File.separator + "index.ftl.html.bam"), is(false)); }