GuidedDecisionTableAccordion { public void addItem(final GuidedDecisionTableAccordionItem.Type type, final Widget widget) { addItem(makeItem(type, widget)); } @Inject  GuidedDecisionTableAccordion(final View view,
                                        final ManagedInstance<GuidedDecisionTableAccordionItem> itemManagedInstance); @PostConstruct void setup(); View getView(); void addItem(final GuidedDecisionTableAccordionItem.Type type,
                        final Widget widget); void clear(); GuidedDecisionTableAccordionItem getItem(final GuidedDecisionTableAccordionItem.Type type);  }
@Test public void testAddItem() throws Exception { final String parentId = "uuid"; final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class); final GuidedDecisionTableAccordionItem.Type type = GuidedDecisionTableAccordionItem.Type.CONDITION; final Widget widget = mock(Widget.class); final List<GuidedDecisionTableAccordionItem> itemsList = spy(new ArrayList<>()); when(accordion.blankAccordionItem()).thenReturn(item); when(accordion.getItems()).thenReturn(itemsList); when(accordion.getParentId()).thenReturn(parentId); accordion.addItem(type, widget); verify(view).addItem(item); verify(itemsList).add(item); verify(item).init(parentId, type, widget); }