### Question:
SupportAwareProcessorDecorator extends ProcessorDecorator { @Override public void process(final Resource resource, final Reader reader, final Writer writer) throws IOException { final ResourcePreProcessor decoratedProcessor = getDecoratedObject(); if (decoratedProcessor instanceof SupportAware) { if (!((SupportAware) decoratedProcessor).isSupported()) { throw new WroRuntimeException(toString() + " processor is not supported on this environment"); } } super.process(resource, reader, writer); } SupportAwareProcessorDecorator(final Object processor); @Override void process(final Resource resource, final Reader reader, final Writer writer);  }### Answer:
@Test public void shouldInvokeDecoratedProcessorWhenProcessorIsSupported() throws Exception { Mockito.when(mockProcessor.isSupported()).thenReturn(true); victim = new SupportAwareProcessorDecorator(mockProcessor); victim.process(mockResource, mockReader, mockWriter); Mockito.verify(mockProcessor).process(Mockito.any(Resource.class), Mockito.any(Reader.class), Mockito.any(Writer.class)); }
@Test(expected = WroRuntimeException.class) public void shouldThrowExceptionWhenProcessorIsNotSupported() throws Exception { Mockito.when(mockProcessor.isSupported()).thenReturn(false); victim = new SupportAwareProcessorDecorator(mockProcessor); victim.process(mockResource, mockReader, mockWriter); }