UserEditorScreen { void onUserDeleted(@Observes final DeleteUserEvent deleteUserEvent) { final String deletedId = deleteUserEvent.getIdentifier(); if (userId != null && userId.equals(deletedId)) { closeEditor(); } }  @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 testOnUserDeleted() { final DeleteUserEvent deleteUserEvent = mock(DeleteUserEvent.class); when(deleteUserEvent.getIdentifier()).thenReturn("user1"); tested.userId = "user1"; tested.onUserDeleted(deleteUserEvent); verify(placeManager, times(1)).closePlace(any(PlaceRequest.class)); }