@Test public void testprunedPattern() throws Exception { ApiSurface apiSurface = ApiSurface.ofClass(NotPruned.class).pruningClass(PrunedPattern.class); assertThat(apiSurface.getExposedClasses(), containsInAnyOrder((Class) NotPruned.class)); }
@Test public void testIgnoreAll() throws Exception { ApiSurface apiSurface = ApiSurface.ofClass(ExposedWildcardBound.class) .includingClass(Object.class) .includingClass(ApiSurface.class) .pruningPattern(".*"); assertThat(apiSurface.getExposedClasses(), emptyIterable()); }
@SuppressWarnings({"rawtypes", "unchecked"}) private void assertExposed(final Class classToExamine, final Class... exposedClasses) { final ApiSurface apiSurface = ApiSurface.ofClass(classToExamine).pruningPrefix("java"); final ImmutableSet<Matcher<Class<?>>> allowed = FluentIterable.from( Iterables.concat(Sets.newHashSet(classToExamine), Sets.newHashSet(exposedClasses))) .transform(Matchers::<Class<?>>equalTo) .toSet(); assertThat(apiSurface, containsOnlyClassesMatching(allowed)); }