| 6 | import static org.junit.Assert.*; |
| 7 | |
| 8 | public class ClasspathScannerTest { |
| 9 | private ClasspathScanner scanner; |
| 10 | |
| 11 | @Test |
| 12 | public void getPackage() { |
| 13 | scanner = new ClasspathScanner("org.hibernate.*"); |
| 14 | assertEquals("Package was sanitized", "org/hibernate", scanner.getPackage()); |
| 15 | } |
| 16 | |
| 17 | @Test(expected = IllegalArgumentException.class) |
| 18 | public void getClasses() throws IOException { |
| 19 | scanner = new ClasspathScanner("org.hibernate.annotations.common.*"); |
| 20 | Set<String> classes = scanner.getClasses(); |
| 21 | assertTrue(classes.size() == 2); |
| 22 | assertTrue(classes.contains("org.hibernate.annotations.common.AssertionFailure")); |
| 23 | assertTrue(classes.contains("org.hibernate.annotations.common.TestDirectoryScan")); |
| 24 | scanner = new ClasspathScanner("org.hibernate.annotations.common.*", true); |
| 25 | classes = scanner.getClasses(); |
| 26 | assertTrue(classes.size() == 61); |
| 27 | assertTrue(classes.contains("org.hibernate.annotations.common.other.another.AnotherTestDirectoryScan")); |
| 28 | scanner = new ClasspathScanner("x.y.z", true); |
| 29 | assertTrue(scanner.getClasses().size() == 0); |
| 30 | scanner = new ClasspathScanner(""); |
| 31 | } |
| 32 | |
| 33 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…