### Question:
ReassignmentEditorWidget implements IsWidget,
                                                 ReassignmentEditorWidgetView.Presenter { @Override public void createOrEdit(ReassignmentWidgetView parent, ReassignmentRow row) { view.createOrEdit(parent, row); } @Inject  ReassignmentEditorWidget(ReassignmentEditorWidgetView view,
                                    ClientTranslationService translationService); @Override Widget asWidget(); @Override String getNameHeader(); @Override void createOrEdit(ReassignmentWidgetView parent, ReassignmentRow row); void setReadOnly(boolean readOnly);  }### Answer:
@Test public void testCreateAndSaveEmpty() { ReassignmentRow test = new ReassignmentRow(); doNothing().when(view).hide(); when(customerBinder.getModel()).thenReturn(test); when(notCompleted.getValue()).thenReturn(ReassignmentType.NotCompletedReassign.getAlias()); when(typeSelect.getSelectedItem()).thenReturn(notCompleted); when(multipleLiveSearchSelectionHandlerGroups.getSelectedValues()).thenReturn(Collections.EMPTY_LIST); when(multipleLiveSearchSelectionHandlerUsers.getSelectedValues()).thenReturn(Collections.EMPTY_LIST); view.createOrEdit(reassignmentWidgetViewImpl, test); view.ok(); ReassignmentRow result = getFieldValue(ReassignmentEditorWidgetViewImpl.class, view, "current"); Assert.assertEquals(result, test); }
@Test public void testCreateAndSave() { List<String> groups = Arrays.asList("AAA", "BBB", "CCC", "DDD"); List<String> users = Arrays.asList("aaa", "bbb", "ccc"); doNothing().when(view).hide(); ReassignmentRow test = new ReassignmentRow(); doNothing().when(view).hide(); when(customerBinder.getModel()).thenReturn(test); when(notCompleted.getValue()).thenReturn(ReassignmentType.NotCompletedReassign.getAlias()); when(typeSelect.getSelectedItem()).thenReturn(notCompleted); when(multipleLiveSearchSelectionHandlerGroups.getSelectedValues()).thenReturn(groups); when(multipleLiveSearchSelectionHandlerUsers.getSelectedValues()).thenReturn(users); view.createOrEdit(reassignmentWidgetViewImpl, test); view.ok(); Assert.assertEquals(ReassignmentType.NotCompletedReassign, test.getType()); Assert.assertEquals(groups, test.getGroups()); Assert.assertEquals(users, test.getUsers()); }
@Test public void testCreateAndClose() { List<String> groups = Arrays.asList("AAA", "BBB", "CCC", "DDD"); List<String> users = Arrays.asList("aaa", "bbb", "ccc"); doNothing().when(view).hide(); ReassignmentRow test = new ReassignmentRow(); doNothing().when(view).hide(); when(customerBinder.getModel()).thenReturn(test); when(notCompleted.getValue()).thenReturn(ReassignmentType.NotStartedReassign.getAlias()); when(typeSelect.getSelectedItem()).thenReturn(notCompleted); when(multipleLiveSearchSelectionHandlerGroups.getSelectedValues()).thenReturn(groups); when(multipleLiveSearchSelectionHandlerUsers.getSelectedValues()).thenReturn(users); view.createOrEdit(reassignmentWidgetViewImpl, test); view.close(); Assert.assertNotEquals(ReassignmentType.NotStartedReassign, test.getType()); Assert.assertNotEquals(groups, test.getGroups()); Assert.assertNotEquals(users, test.getUsers()); }