SecurityExplorerScreen { void onRoleRead(@Observes final ReadRoleEvent readRoleEvent) { checkNotNull("event", readRoleEvent); final String name = readRoleEvent.getName(); final Map<String, String> params = new HashMap(1); params.put(RoleEditorScreen.ROLE_NAME, name); placeManager.goTo(new DefaultPlaceRequest(RoleEditorScreen.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 testOnRoleRead() { final ReadRoleEvent event = mock(ReadRoleEvent.class); when(event.getName()).thenReturn("someRoleName"); final ArgumentCaptor<DefaultPlaceRequest> placeRequestArgumentCaptor = ArgumentCaptor.forClass(DefaultPlaceRequest.class); tested.onRoleRead(event); verify(placeManager, times(1)).goTo(placeRequestArgumentCaptor.capture()); final DefaultPlaceRequest placeRequest = placeRequestArgumentCaptor.getValue(); assertEquals(RoleEditorScreen.SCREEN_ID, placeRequest.getIdentifier()); assertEquals("someRoleName", placeRequest.getParameters().get(RoleEditorScreen.ROLE_NAME)); }