### Question:
StoppedOrExitedProcessor extends
        AbstractProcessorDecorator<TDef> { @Override public Variable run(final DynamicScopeContext context) throws InterruptedException { final ScraperState status = statusHolder.getStatus(); if (status == ScraperState.STOPPED || status == ScraperState.EXIT) { return EmptyVariable.INSTANCE; } return decoratedProcessor.run(context); } StoppedOrExitedProcessor(final Processor<TDef> decoratedProcessor); @Override Variable run(final DynamicScopeContext context);  }### Answer:
@Test public void runIfStoppedStatus() throws Exception { expect(mockStatusHolder.getStatus()) .andReturn(ScraperState.STOPPED); EasyMockUnitils.replay(); final Variable result = processor.run(mockContext); assertNotNull("Result variable is null.", result); assertEquals("Unexpected variable.", result, EmptyVariable.INSTANCE); }
@Test public void runIfExitStatus() throws Exception { expect(mockStatusHolder.getStatus()) .andReturn(ScraperState.EXIT); EasyMockUnitils.replay(); final Variable result = processor.run(mockContext); assertNotNull("Result variable is null.", result); assertEquals("Unexpected variable.", result, EmptyVariable.INSTANCE); }
@Test public void run() throws Exception { final Variable var = EmptyVariable.INSTANCE; expect(mockStatusHolder.getStatus()) .andReturn(ScraperState.RUNNING); expect(mockProcessor.run(eq(mockContext))) .andReturn(var); EasyMockUnitils.replay(); final Variable result = processor.run(mockContext); assertNotNull("Result variable is null.", result); assertEquals("Unexpected variable.", result, var); }