### Question:
DefaultHandlerHolder implements HandlerHolder,
        ScrapingAware { @Override public void onBeforeScraping(final Harvester harvester) { if (harvester == null) { throw new IllegalArgumentException("Harvester is required"); } final EventBus eventBus = provider.get(); for (final EventHandler<?> handler : handlers) { eventBus.register(handler); LOG.debug("Registered event bus handler [{}]", handler); } try { registry.bind(harvester, eventBus); } catch (AlreadyBoundException e) { throw new RuntimeException(e); } } @Inject  DefaultHandlerHolder(final Registry<Harvester, EventBus> registry,
            final Provider<EventBus> provider); @Override void register(final EventHandler<?> handler); @Override void onBeforeScraping(final Harvester harvester); @Override void onAfterScraping(final Harvester harvester);  }### Answer:
@Test public void testOnBeforeScraping() throws Exception { expect(mockProvider.get()).andReturn(mockEventBus); mockEventBus.register(mockHandler); expectLastCall(); mockRegistry.bind(mockHarvester, mockEventBus); expectLastCall(); EasyMockUnitils.replay(); holder.register(mockHandler); holder.onBeforeScraping(mockHarvester); }
@Test(expectedExceptions=IllegalArgumentException.class) public void testOnBeforeScrapingWithoutgHarvester() throws Exception { holder.onBeforeScraping(null); }