UserEditorScreen { void onShowUserEvent(@Observes final OnShowEvent onShowEvent) { if (checkEventContext(onShowEvent, userEditorWorkflow.getUserEditor())) { try { User user = (User) onShowEvent.getInstance(); this.userId = user.getIdentifier(); final String title = new SafeHtmlBuilder() .appendEscaped(UsersManagementWorkbenchConstants.INSTANCE.showUser(user.getIdentifier())) .toSafeHtml().asString(); changeTitleNotification.fire(new ChangeTitleWidgetEvent(placeRequest, title)); } catch (ClassCastException e) { } } }  @PostConstruct void init(); @OnStartup void onStartup(final PlaceRequest placeRequest); @OnOpen void onOpen(); @OnMayClose boolean onMayClose(); @OnClose void onClose(); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getWidget(); @WorkbenchContextId String getMyContextRef(); static final String SCREEN_ID; static final String USER_ID; static final String ADD_USER; }
@Test public void testOnShowUserEvent() { final OnShowEvent onShowEvent = mock(OnShowEvent.class); when(onShowEvent.getContext()).thenReturn(userEditor); when(onShowEvent.getInstance()).thenReturn(user); tested.onShowUserEvent(onShowEvent); verify(changeTitleNotification, times(1)).fire(any(ChangeTitleWidgetEvent.class)); }