File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\test\src\test\java\jenkins\ExtensionFilterTest.java.html

1 package jenkins;
2
3 import hudson.ExtensionComponent;
4 import hudson.console.ConsoleAnnotatorFactory;
5 import hudson.model.PageDecorator;
6 import org.jvnet.hudson.test.HudsonTestCase;
7 import org.jvnet.hudson.test.TestExtension;
8
9 /**
10 * @author Kohsuke Kawaguchi
11 */
12 public class ExtensionFilterTest extends HudsonTestCase {
13 public void testFilter() {
14 assertTrue(PageDecorator.all().isEmpty());
15 assertTrue(ConsoleAnnotatorFactory.all().isEmpty());
16 }
17
18 @TestExtension("testFilter")
19 public static class Impl extends ExtensionFilter {
20 @Override
21 public <T> boolean allows(Class<T> type, ExtensionComponent<T> component) {
22 if (type==ConsoleAnnotatorFactory.class)
23 return false;
24 if (component.isDescriptorOf(PageDecorator.class))
25 return false;
26 return true;
27 }
28 }
29 }
30