TerminationConfigForm implements IsWidget { public void setModel(TerminationConfigModel terminationConfigModel) { model = terminationConfigModel; initTerminationTree(model); } @Inject  TerminationConfigForm(TerminationConfigFormView view,
                                 ManagedInstance<TerminationTreeItemContent> terminationTreeItemContentProvider); void displayEmptyTreeLabel(boolean visible); void addNewTerminationType(String terminationType,
                                      TerminationTreeItemContent treeItemContent); void destroyTerminationTreeItemContent(TerminationTreeItemContent terminationTreeItemContent); void setModel(TerminationConfigModel terminationConfigModel); TreeItem getRootTreeItem(); Object getTerminationValue(TerminationConfigModel terminationConfigModel,
                                      TerminationConfigOption terminationConfigOption); @Override Widget asWidget();  }
@Test public void setModel() { TerminationConfigModel terminationConfigModel = new TerminationConfigModel(); terminationConfigModel.setBestScoreFeasible(Boolean.TRUE); terminationConfigModel.setMillisecondsSpentLimit(10l); List<TerminationConfigModel> terminationConfigModelList = Arrays.asList(new TerminationConfigModel()); terminationConfigModel.setTerminationConfigList(terminationConfigModelList); when(terminationTreeItemContentProvider.get()).thenReturn(terminationTreeItemContent); form.setModel(terminationConfigModel); ArgumentCaptor<TreeItem> treeItemArgumentCaptor = ArgumentCaptor.forClass(TreeItem.class); verify(view).initTree(treeItemArgumentCaptor.capture()); TreeItem treeItem = treeItemArgumentCaptor.getValue(); Assert.assertEquals(3, treeItem.getChildCount()); }