### Question:
ProcessorDecorator extends AbstractProcessorDecoratorSupport<ResourcePreProcessor> { public final boolean isEligible(final boolean minimize, final ResourceType searchedType) { Validate.notNull(searchedType); final SupportedResourceType supportedType = getSupportedResourceType(); final boolean isTypeSatisfied = supportedType == null || (supportedType != null && searchedType == supportedType.value()); final boolean isMinimizedSatisfied = minimize == true || !isMinimize(); return isTypeSatisfied && isMinimizedSatisfied; } ProcessorDecorator(final Object processor); void process(final Resource resource, final Reader reader, final Writer writer); final boolean isEligible(final boolean minimize, final ResourceType searchedType); @Override String toString();  }### Answer:
@Test(expected = NullPointerException.class) public void cannotAcceptNullResourceTypeForIsEligible() { assertTrue(new ProcessorDecorator(new JSMinProcessor()).isEligible(true, null)); }
@Test public void shouldComputeEligibilityForMinimizeAwareProcessorWithJsType() { assertTrue(new ProcessorDecorator(new JSMinProcessor()).isEligible(true, ResourceType.JS)); assertFalse(new ProcessorDecorator(new JSMinProcessor()).isEligible(true, ResourceType.CSS)); assertFalse(new ProcessorDecorator(new JSMinProcessor()).isEligible(false, ResourceType.JS)); assertFalse(new ProcessorDecorator(new JSMinProcessor()).isEligible(false, ResourceType.CSS)); }
@Test public void shouldComputeEligibilityForProcessorWithJsType() { assertTrue(new ProcessorDecorator(new SemicolonAppenderPreProcessor()).isEligible(true, ResourceType.JS)); assertTrue(new ProcessorDecorator(new SemicolonAppenderPreProcessor()).isEligible(false, ResourceType.JS)); assertFalse(new ProcessorDecorator(new SemicolonAppenderPreProcessor()).isEligible(true, ResourceType.CSS)); assertFalse(new ProcessorDecorator(new SemicolonAppenderPreProcessor()).isEligible(false, ResourceType.CSS)); }
@Test public void shouldComputeEligibilityForProcessorWithCssType() { assertTrue(new ProcessorDecorator(new CssVariablesProcessor()).isEligible(true, ResourceType.CSS)); assertTrue(new ProcessorDecorator(new CssVariablesProcessor()).isEligible(false, ResourceType.CSS)); assertFalse(new ProcessorDecorator(new CssVariablesProcessor()).isEligible(true, ResourceType.JS)); assertFalse(new ProcessorDecorator(new CssVariablesProcessor()).isEligible(false, ResourceType.JS)); }
@Test public void shouldComputeEligibilityForMinimizeAwareProcessorWithCssType() { assertTrue(new ProcessorDecorator(new CssMinProcessor()).isEligible(true, ResourceType.CSS)); assertFalse(new ProcessorDecorator(new CssMinProcessor()).isEligible(false, ResourceType.CSS)); assertFalse(new ProcessorDecorator(new CssMinProcessor()).isEligible(true, ResourceType.JS)); assertFalse(new ProcessorDecorator(new CssMinProcessor()).isEligible(false, ResourceType.JS)); }
@Test public void shouldComputeEligibilityForProcessorWithNoTypeAndNotMinimizeAware() { final ResourcePreProcessor noOpProcessor = new ResourcePreProcessor() { public void process(final Resource resource, final Reader reader, final Writer writer) throws IOException { } }; assertTrue(new ProcessorDecorator(noOpProcessor).isEligible(true, ResourceType.CSS)); assertTrue(new ProcessorDecorator(noOpProcessor).isEligible(false, ResourceType.CSS)); assertTrue(new ProcessorDecorator(noOpProcessor).isEligible(true, ResourceType.JS)); assertTrue(new ProcessorDecorator(noOpProcessor).isEligible(false, ResourceType.JS)); }