SecurityExplorerScreen { void onUserRead(@Observes final ReadUserEvent readUserEvent) { checkNotNull("event", readUserEvent); final String id = readUserEvent.getIdentifier(); final Map<String, String> params = new HashMap<String, String>(1); params.put(UserEditorScreen.USER_ID, id); placeManager.goTo(new DefaultPlaceRequest(UserEditorScreen.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 testOnUserRead() { final ReadUserEvent event = mock(ReadUserEvent.class); when(event.getIdentifier()).thenReturn("someUserId"); final ArgumentCaptor<DefaultPlaceRequest> placeRequestArgumentCaptor = ArgumentCaptor.forClass(DefaultPlaceRequest.class); tested.onUserRead(event); verify(placeManager, times(1)).goTo(placeRequestArgumentCaptor.capture()); final DefaultPlaceRequest placeRequest = placeRequestArgumentCaptor.getValue(); assertEquals(UserEditorScreen.SCREEN_ID, placeRequest.getIdentifier()); assertEquals("someUserId", placeRequest.getParameters().get(UserEditorScreen.USER_ID)); assertFalse(placeRequest.getParameters().containsKey(UserEditorScreen.ADD_USER)); }