GroupCreationWorkflow implements IsWidget { void onAssignUsers(@Observes final AddUsersToGroupEvent addUsersToGroupEvent) { final Object editor = addUsersToGroupEvent.getContext(); if (editor != null && editor.equals(groupUsersAssignment)) { final Set<String> users = addUsersToGroupEvent.getUsers(); assignUsers(users); } } @Inject  GroupCreationWorkflow(final ClientUserSystemManager userSystemManager,
                                 final Caller<AuthorizationService> authorizationService,
                                 final PermissionManager permissionManager,
                                 final Event<OnErrorEvent> errorEvent,
                                 final ConfirmBox confirmBox,
                                 final LoadingBox loadingBox,
                                 final Event<NotificationEvent> workbenchNotification,
                                 final CreateEntity createEntity,
                                 final GroupUsersAssignment groupUsersAssignment,
                                 final Event<CreateGroupEvent> onCreateGroupEvent,
                                 final EntityWorkflowView view); @PostConstruct void init(); void create(); void clear(); @Override Widget asWidget();  }
@Test public void testOnAssignUsers() { final AddUsersToGroupEvent addUsersToGroupEvent = mock(AddUsersToGroupEvent.class); final Set<String> users = new HashSet<String>(1); users.add("user1"); when(addUsersToGroupEvent.getContext()).thenReturn(groupUsersAssignment); when(addUsersToGroupEvent.getUsers()).thenReturn(users); tested.group = group; tested.onAssignUsers(addUsersToGroupEvent); verify(loadingBox, times(1)).show(); verify(loadingBox, times(1)).hide(); verify(workbenchNotification, times(1)).fire(any(NotificationEvent.class)); verify(onCreateGroupEvent, times(1)).fire(any(CreateGroupEvent.class)); verify(createEntity, times(1)).show(anyString(), anyString()); verify(view, times(1)).setCancelButtonVisible(false); verify(view, times(1)).setCallback(any(EntityWorkflowView.Callback.class)); verify(view, times(1)).setSaveButtonText(anyString()); verify(view, times(1)).setWidget(any(IsWidget.class)); verify(view, times(1)).setSaveButtonVisible(true); verify(view, times(1)).setSaveButtonEnabled(true); verify(view, times(1)).clearNotifications(); }