ExternalComponentGroupProvider implements PerspectiveEditorComponentGroupProvider { ExternalComponentDragDef produceDragComponent(ExternalComponent comp) { ExternalComponentDragDef dragComp; if (comp.isNoData()) { dragComp = beanManager.lookupBean(ExternalDragComponent.class).getInstance(); } else { dragComp = beanManager.lookupBean(ExternalDisplayerDragComponent.class).getInstance(); } dragComp.setDragInfo(comp.getName(), comp.getIcon()); dragComp.setComponentId(comp.getId()); return dragComp; }  @AfterInitialization void loadComponents(); @Override String getName(); @Override LayoutDragComponentGroup getComponentGroup();  }
@Test public void testProduceDragComponent() { when(c1Bean.getInstance()).thenReturn(drag1); when(beanManager.lookupBean(eq(ExternalDragComponent.class))).thenReturn(c1Bean); when(c2Bean.getInstance()).thenReturn(drag2); when(beanManager.lookupBean(eq(ExternalDisplayerDragComponent.class))).thenReturn(c2Bean); when(c1.isNoData()).thenReturn(false); when(c2.isNoData()).thenReturn(true); externalComponentGroupProvider.produceDragComponent(c1); externalComponentGroupProvider.produceDragComponent(c2); verify(beanManager).lookupBean(eq(ExternalDisplayerDragComponent.class)); verify(beanManager).lookupBean(eq(ExternalDragComponent.class)); }