45 public static void main(String[] args) throws Exception { |
45 public static void main(String[] args) throws Exception { |
46 new ExcludePluginTest().test(); |
46 new ExcludePluginTest().test(); |
47 } |
47 } |
48 |
48 |
49 public void test() throws Exception { |
49 public void test() throws Exception { |
50 check("*.jcov", "/num/toto.jcov", true); |
50 check("**.jcov", "/num/toto.jcov", true); |
51 check("*.jcov", "//toto.jcov", true); |
51 check("**.jcov", "//toto.jcov", true); |
52 check("*.jcov", "/toto.jcov/tutu/tata", false); |
52 check("**.jcov", "/toto.jcov/tutu/tata", false); |
53 check("/java.base/*.jcov", "/java.base/toto.jcov", true); |
53 check("/java.base/*.jcov", "/java.base/toto.jcov", true); |
54 check("/java.base/toto.jcov", "t/java.base/iti.jcov", false); |
54 check("/java.base/toto.jcov", "t/java.base/iti.jcov", false); |
55 check("/java.base/*/toto.jcov", "/java.base/toto.jcov", false); |
55 check("/java.base/*/toto.jcov", "/java.base/toto.jcov", false); |
56 check("/java.base/*/toto.jcov", "/java.base/tutu/toto.jcov", true); |
56 check("/java.base/*/toto.jcov", "/java.base/tutu/toto.jcov", true); |
57 check("*/java.base/*/toto.jcov", "/tutu/java.base/tutu/toto.jcov", true); |
57 check("**/java.base/*/toto.jcov", "/tutu/java.base/tutu/toto.jcov", true); |
58 check("*/META-INF/*", "/META-INF/services/ MyProvider ", false); |
58 check("/META-INF/**", "/META-INF/services/ MyProvider ", true); |
59 check("*/META-INF/*", "/META-INF/services/MyProvider", false); |
59 check("/META-INF/**", "/META-INF/services/MyProvider", true); |
60 check("*/META-INF", " /META-INF/services/MyProvider", false); |
60 check("**/META-INF", " /META-INF/services/MyProvider", false); |
61 check("*/META-INF/*", "/java.base//META-INF/services/MyProvider", true); |
61 check("**/META-INF/**", "/java.base//META-INF/services/MyProvider", true); |
62 check("/java.base/*/Toto$Titi.class", "/java.base/tutu/Toto$Titi.class", true); |
62 check("/java.base/*/Toto$Titi.class", "/java.base/tutu/Toto$Titi.class", true); |
63 check("/*$*.class", "/java.base/tutu/Toto$Titi.class", true); |
63 check("/**$**.class", "/java.base/tutu/Toto$Titi.class", true); |
64 check("*$*.class", "/java.base/tutu/Toto$Titi.class", true); |
64 check("**$**.class", "/java.base/tutu/Toto$Titi.class", true); |
65 |
65 |
66 // Excluded resource list in a file |
66 // Excluded resource list in a file |
67 File order = new File("resources.exc"); |
67 File order = new File("resources.exc"); |
68 order.createNewFile(); |
68 order.createNewFile(); |
69 Files.write(order.toPath(), "*.jcov".getBytes()); |
69 Files.write(order.toPath(), "**.jcov".getBytes()); |
70 check(order.getAbsolutePath(), "/num/toto.jcov", true); |
70 check("@" + order.getAbsolutePath(), "/num/toto.jcov", true); |
71 } |
71 } |
72 |
72 |
73 public void check(String s, String sample, boolean exclude) throws Exception { |
73 public void check(String s, String sample, boolean exclude) throws Exception { |
74 Map<String, String> prop = new HashMap<>(); |
74 Map<String, String> prop = new HashMap<>(); |
75 prop.put(ExcludePlugin.NAME, s); |
75 prop.put(ExcludePlugin.NAME, s); |