SecurityExplorerScreen { void onGroupCreate(@Observes final NewGroupEvent newGroupEvent) { checkNotNull("event", newGroupEvent); final Map<String, String> params = new HashMap(1); params.put(GroupEditorScreen.ADD_GROUP, "true"); placeManager.goTo(new DefaultPlaceRequest(GroupEditorScreen.SCREEN_ID, params)); } @Inject  SecurityExplorerScreen(final View view,
                                  final RolesExplorer rolesExplorer,
                                  final GroupsExplorer groupsExplorer,
                                  final UsersExplorer usersExplorer,
                                  final ErrorPopupPresenter errorPopupPresenter,
                                  final PlaceManager placeManager,
                                  final ClientUserSystemManager userSystemManager,
                                  final ClientSecurityExceptionMessageResolver exceptionMessageResolver); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getWidget(); @PostConstruct void init(); @OnStartup void onStartup(final PlaceRequest placeRequest); @OnClose void onClose(); static final String SCREEN_ID; static final String ACTIVE_TAB; static final String ROLES_TAB; static final String GROUPS_TAB; static final String USERS_TAB; }
@Test public void testOnGroupCreate() { final NewGroupEvent event = mock(NewGroupEvent.class); final ArgumentCaptor<DefaultPlaceRequest> placeRequestArgumentCaptor = ArgumentCaptor.forClass(DefaultPlaceRequest.class); tested.onGroupCreate(event); verify(placeManager, times(1)).goTo(placeRequestArgumentCaptor.capture()); final DefaultPlaceRequest placeRequest = placeRequestArgumentCaptor.getValue(); assertEquals(GroupEditorScreen.SCREEN_ID, placeRequest.getIdentifier()); assertTrue(Boolean.parseBoolean(placeRequest.getParameters().get(GroupEditorScreen.ADD_GROUP))); assertFalse(placeRequest.getParameters().containsKey(GroupEditorScreen.GROUP_NAME)); }