UserEditorScreen { void onEditUserEvent(@Observes final OnEditEvent onEditEvent) { if (checkEventContext(onEditEvent, userEditorWorkflow.getUserEditor())) { try { User user = (User) onEditEvent.getInstance(); this.userId = user.getIdentifier(); changeTitleNotification.fire(new ChangeTitleWidgetEvent(placeRequest, new SafeHtmlBuilder() .appendEscaped(UsersManagementWorkbenchConstants.INSTANCE.editUser(user.getIdentifier())) .toSafeHtml().asString())); } 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 testOnEditUserEvent() { final OnEditEvent onEditEvent = mock(OnEditEvent.class); when(onEditEvent.getContext()).thenReturn(userEditor); when(onEditEvent.getInstance()).thenReturn(user); tested.onEditUserEvent(onEditEvent); verify(changeTitleNotification, times(1)).fire(any(ChangeTitleWidgetEvent.class)); }