@@ -0,0 +1,3130 @@
+package ro.isdc.wro.model.resource.processor.decorator;%0A%0Aimport java.io.IOException;%0Aimport java.io.Reader;%0Aimport java.io.StringReader;%0Aimport java.io.StringWriter;%0Aimport java.io.Writer;%0A%0Aimport junit.framework.Assert;%0A%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mock;%0Aimport org.mockito.Mockito;%0Aimport org.mockito.MockitoAnnotations;%0A%0Aimport ro.isdc.wro.WroRuntimeException;%0Aimport ro.isdc.wro.config.Context;%0Aimport ro.isdc.wro.model.resource.Resource;%0Aimport ro.isdc.wro.model.resource.processor.ResourcePreProcessor;%0Aimport ro.isdc.wro.model.resource.processor.impl.js.JSMinProcessor;%0Aimport ro.isdc.wro.util.WroTestUtils;%0A%0A%0A/**%0A * @author Alex Objelean%0A */%0Apublic class TestExceptionHandlingProcessorDecorator %7B%0A  @Mock %0A  private ResourcePreProcessor mockProcessor;%0A  @Mock %0A  private Resource mockResource;%0A  private ExceptionHandlingProcessorDecorator victim;%0A  %0A  @Before%0A  public void setUp() %7B%0A    Context.set(Context.standaloneContext());%0A    MockitoAnnotations.initMocks(this);%0A    victim = new ExceptionHandlingProcessorDecorator(mockProcessor);%0A    WroTestUtils.createInjector().inject(victim);%0A  %7D%0A  %0A  @After%0A  public void tearDown() %7B%0A    Context.unset();%0A  %7D%0A  %0A  @Test(expected = NullPointerException.class)%0A  public void cannotDecorateNullProcessor() %7B%0A    new ExceptionHandlingProcessorDecorator(null);%0A  %7D%0A  %0A  @Test%0A  public void shouldInvokeDecoratedProcessor() throws Exception %7B%0A    mockProcessor = Mockito.spy(new JSMinProcessor());%0A    victim = new ExceptionHandlingProcessorDecorator(mockProcessor);%0A    %0A    final String resourceContent = %22alert(  1  );%22;%0A    final StringWriter writer = new StringWriter();%0A    final Reader reader = new StringReader(resourceContent);%0A%0A    victim.process(mockResource, reader, writer);%0A    Mockito.verify(mockProcessor).process(Mockito.any(Resource.class), Mockito.any(Reader.class),%0A        Mockito.any(Writer.class));%0A    Assert.assertEquals(%22%5Cnalert(1);%22, writer.toString());%0A  %7D%0A  %0A  @Test(expected = WroRuntimeException.class)%0A  public void shouldThrowRuntimeExceptionWhenProcessingFails()%0A      throws Exception %7B%0A    Mockito.doThrow(new IOException(%22BOOM%22)).when(mockProcessor).process(Mockito.any(Resource.class),%0A        Mockito.any(Reader.class), Mockito.any(Writer.class));%0A    victim.process(mockResource, new StringReader(%22%22), new StringWriter());%0A  %7D%0A  %0A%0A  @Test%0A  public void shouldPreserveContentWhenProcessingFails()%0A      throws Exception %7B%0A    Context.get().getConfig().setIgnoreFailingProcessor(true);%0A    %0A    Mockito.doThrow(new IOException(%22BOOM%22)).when(mockProcessor).process(Mockito.any(Resource.class),%0A        Mockito.any(Reader.class), Mockito.any(Writer.class));%0A    %0A    final String resourceContent = %22alert(1);%22;%0A    final StringWriter writer = new StringWriter();%0A    final Reader reader = new StringReader(resourceContent);%0A    %0A    victim.process(mockResource, reader, writer);%0A    Mockito.verify(mockProcessor).process(Mockito.any(Resource.class), Mockito.any(Reader.class),%0A        Mockito.any(Writer.class));%0A    Assert.assertEquals(resourceContent, writer.toString());%0A  %7D%0A%7D%0A

create unit tests for ExceptionHandlingProcessorDecorator