### Question:
DocumentController implements IDocumentController, IDocumentListener, IRequiresMetaverseBuilder { @Override public void onEvent( IDocumentEvent event ) { List<IDocumentAnalyzer> matchingAnalyzers = getDocumentAnalyzers( event.getDocument().getExtension() ); if ( matchingAnalyzers != null ) { for ( IDocumentAnalyzer analyzer : matchingAnalyzers ) { fireDocumentEvent( event, analyzer ); } } else { log.warn( Messages.getString( "WARNING.NoMatchingDocumentAnalyzerFound", event.getDocument().getExtension() ) ); } } DocumentController();  DocumentController( IMetaverseBuilder metaverseBuilder ); @Override IMetaverseBuilder getMetaverseBuilder(); @Override void setMetaverseBuilder( IMetaverseBuilder metaverseBuilder ); IMetaverseObjectFactory getMetaverseObjectFactory(); void setMetaverseObjectFactory( IMetaverseObjectFactory metaverseObjectFactory ); @Override Graph getGraph(); @Override void setGraph( Graph graph ); @Override List<IDocumentAnalyzer> getAnalyzers(); @Override List<IDocumentAnalyzer> getDocumentAnalyzers( String type ); @Override List<IDocumentAnalyzer> getAnalyzers( Collection<Class<?>> types ); @Override void setDocumentAnalyzers( List<IDocumentAnalyzer> documentAnalyzers ); void setClonableDocumentAnalyzers( List<IDocumentAnalyzer> documentAnalyzers ); @Override void onEvent( IDocumentEvent event ); void addClonableAnalyzer( final IClonableDocumentAnalyzer analyzer ); @Override void addAnalyzer( IDocumentAnalyzer analyzer ); void removeClonableAnalyzer( final IClonableDocumentAnalyzer analyzer ); @Override void removeAnalyzer( IDocumentAnalyzer analyzer ); @Override IMetaverseBuilder addNode( IMetaverseNode iMetaverseNode ); @Override IMetaverseBuilder addLink( IMetaverseLink iMetaverseLink ); @Override IMetaverseBuilder deleteNode( IMetaverseNode iMetaverseNode ); @Override IMetaverseBuilder deleteLink( IMetaverseLink iMetaverseLink ); @Override IMetaverseBuilder updateNode( IMetaverseNode iMetaverseNode ); @Override IMetaverseBuilder updateLinkLabel( IMetaverseLink iMetaverseLink, String newLabel ); @Override IMetaverseBuilder addLink( IMetaverseNode fromNode, String label, IMetaverseNode toNode ); @Override void addLink( Vertex fromVertex, String label, Vertex toVertex );  }### Answer:
@Test public void testOnEvent() throws Exception { when( mockEvent.getDocument() ).thenReturn( mockDoc ); when( mockDoc.getExtension() ).thenReturn( "dummy" ); docController.onEvent( mockEvent ); MetaverseCompletionService.getInstance().waitTillEmpty(); verify( dummyAnalyzer ).analyze( any( IComponentDescriptor.class ), eq( mockDoc ) ); verify( testAndDummyAnalyzer ).analyze( any( IComponentDescriptor.class ), eq( mockDoc ) ); }
@Test public void testOnEvent_notAllAnalyzersFire() throws Exception { when( mockEvent.getDocument() ).thenReturn( mockDoc ); when( mockDoc.getExtension() ).thenReturn( "test" ); docController.onEvent( mockEvent ); MetaverseCompletionService.getInstance().waitTillEmpty(); verify( dummyAnalyzer, never() ).analyze( any( IComponentDescriptor.class ), eq( mockDoc ) ); verify( testAndDummyAnalyzer ).analyze( any( IComponentDescriptor.class ), eq( mockDoc ) ); verify( anotherAnalyzer, never() ).analyze( any( IComponentDescriptor.class ), eq( mockDoc ) ); }
@Test public void testOnEvent_noSupportingAnalyzers() throws Exception { when( mockEvent.getDocument() ).thenReturn( mockDoc ); when( mockDoc.getExtension() ).thenReturn( "notSupported" ); docController.onEvent( mockEvent ); MetaverseCompletionService.getInstance().waitTillEmpty(); verify( dummyAnalyzer, never() ).analyze( mockDescriptor, mockDoc ); verify( anotherAnalyzer, never() ).analyze( mockDescriptor, mockDoc ); verify( testAndDummyAnalyzer, never() ).analyze( mockDescriptor, mockDoc ); }