@Test public void testDoFilter_ClassLoader() throws Exception { ClassFileFilter filter = new UnmodifiableClassFilter(this.getClass().getClassLoader()); Assert.assertFalse(filter.accept(this.getClass().getClassLoader(), "test", null, null, null)); URLClassLoader classLoader = new URLClassLoader(new URL[] {}); Assert.assertTrue(filter.accept(classLoader, "test", null, null, null)); }
@Test public void testDoFilter_Package() throws Exception { ClassFileFilter filter = new UnmodifiableClassFilter(this.getClass().getClassLoader()); Assert.assertFalse(filter.accept(null, "java/test", null, null, null)); Assert.assertFalse(filter.accept(null, "javax/test", null, null, null)); Assert.assertFalse(filter.accept(null, "com.baidu.oped.apm/", null, null, null)); Assert.assertTrue(filter.accept(null, "test", null, null, null)); }