### Question:
ScrapingInterceptor implements MethodInterceptor { @Override public Object invoke(final MethodInvocation invocation) throws Throwable { final Object subject = invocation.getThis(); if (!(subject instanceof Harvester)) { throw new IllegalStateException("Not an instance of Harvester"); } return invoke(InjectorHelper.getInjector(), (Harvester) subject, new Callback() { @Override public Object execute() throws Throwable { return invocation.proceed(); } }); }  @Override Object invoke(final MethodInvocation invocation);  }### Answer:
@Test(expectedExceptions=IllegalStateException.class) public void testInvokeInCaseOfNotHarvester() throws Throwable { expect(mockInvocation.getThis()).andReturn(this); EasyMockUnitils.replay(); interceptor.invoke(mockInvocation); }
@Test public void testInvoke() throws Throwable { expect(mockInvocation.getThis()).andReturn(mockHarvester); expect(mockInvocation.proceed()).andReturn(null); EasyMockUnitils.replay(); interceptor.invoke(mockInvocation); }