@Test public void testFindClassNamesWithJustIncludedGlobs() throws Exception { List<String> expected = Arrays.asList(new String[] {"One"}); List<String> actual = ClassFinder.findClassNames(ROOT_PATH, JUST_INCLUDED_GLOBS); Assert.assertEquals(expected, actual); }
@Test public void testFindClassNamesWithBothIncludedAndExcludedGlobs() throws Exception { List<String> expected = Arrays.asList(new String[] {"One", "Three"}); List<String> actual = ClassFinder.findClassNames(ROOT_PATH, BOTH_INCLUDED_AND_EXCLUDED_GLOBS); Collections.sort(actual); Assert.assertEquals(expected, actual); }
@Test public void testFindClassNamesWithEmptyGlobs() throws Exception { List<String> expected = Arrays.asList(new String[] {"One", "Three", "Two"}); List<String> actual = ClassFinder.findClassNames(ROOT_PATH, EMPTY_GLOBS); Collections.sort(actual); Assert.assertEquals(expected, actual); }
@Test public void testFindClassNamesByUsingTheFormatGlobProcess() throws Exception { Path rootPath = Paths.get(ClassFinder.class.getResource(".").getPath()); List<String> expected = Arrays.asList(new String[] {"samples.One"}); List<String> actual = ClassFinder.findClassNames( rootPath, new Globs(Arrays.asList(new String[] {"One.class"}), null)); Collections.sort(actual); Assert.assertEquals(expected, actual); }
@Test(expected = NullPointerException.class) public void testFindClassNamesWithNullGlobs() throws Exception { ClassFinder.findClassNames(ROOT_PATH, null); }
@Test(expected = IllegalArgumentException.class) public void testFindClassNamesWithNonExistingRootPath() throws Exception { ClassFinder.findClassNames(Paths.get("wrong"), EMPTY_GLOBS); }
@Test(expected = NullPointerException.class) public void testFindClassNamesWithNullRootPath() throws Exception { ClassFinder.findClassNames(null, EMPTY_GLOBS); }