FileNameUtil { public static boolean isIncluded(String name, Map parameters) { checkNotNull(name, "name must be given."); if (parameters == null) { return true; } List<String> includes = getAsList(parameters.get("includes")); List<String> excludes = getAsList(parameters.get("excludes")); return matches(name, includes, true) && !matches(name, excludes, false); } private  FileNameUtil(); static List<File> identifyFiles(Map parameters); static boolean isIncluded(String name, Map parameters); static boolean matches(String name, List<String> patterns, boolean defaultValue); static boolean matches(String name, String pattern); static String getParentPath(String fileName); static String getCanonicalPath(String path);  }
@Test public void isIncluded() { Map<String, Object> parameters = ImmutableMap.<String, Object>builder().put("includes", "**/qav-core*.jar").build(); assertIncluded("BOOT-INF/lib/qav-core.jar", parameters, true); parameters = ImmutableMap.<String, Object>builder().put("includes", "*/qav-core*.jar").build(); assertIncluded("BOOT-INF/lib/qav-core.jar", parameters, false); parameters = ImmutableMap.<String, Object>builder().put("includes", "*/qav-core*.jar").build(); assertIncluded("BOOT-INF/lib/qav-core.jar", parameters, false); parameters = ImmutableMap.<String, Object>builder().put("excludes", "**/qav-core*.jar").build(); assertIncluded("BOOT-INF/lib/qav-core.jar", parameters, false); parameters = ImmutableMap.<String, Object>builder() .put("includes", "**qav*").build(); assertIncluded("BOOT-INF/lib/qav-core.jar", parameters, false); assertIncluded("BOOT-INF/lib/other.jar", parameters, true); parameters = ImmutableMap.<String, Object>builder() .put("includes", new ArrayList<>()) .put("excludes", new ArrayList<>()).build(); assertIncluded("BOOT-INF/lib/qav-core.jar", parameters, true); assertIncluded("BOOT-INF/lib/qav-core.jar", null, true); }