GroupEditorScreen { void onGroupDeleted(@Observes final DeleteGroupEvent deleteGroupEvent) { final String deletedGroup = deleteGroupEvent.getName(); if (groupName != null && groupName.equals(deletedGroup)) { 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 GROUP_NAME; static final String ADD_GROUP; }
@Test public void testOnGroupDeleted() { final DeleteGroupEvent deleteGroupEvent = mock(DeleteGroupEvent.class); when(deleteGroupEvent.getName()).thenReturn("group1"); tested.groupName = "group1"; tested.onGroupDeleted(deleteGroupEvent); verify(placeManager, times(1)).closePlace(any(PlaceRequest.class)); }