RoleEditorScreen { @OnMayClose public boolean onMayClose() { return !roleEditorWorkflow.isDirty() || Window.confirm(UsersManagementWidgetsConstants.INSTANCE.roleIsDirty()); }  @PostConstruct void init(); @OnStartup void onStartup(final PlaceRequest placeRequest); @OnMayClose boolean onMayClose(); @OnClose void onClose(); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getWidget(); @WorkbenchContextId String getMyContextRef(); static final String SCREEN_ID; static final String ROLE_NAME; }
@Test public void testOnMayCloseSuccess() { when(roleEditorWorkflow.isDirty()).thenReturn(false); assertTrue(tested.onMayClose()); }
@Test public void testOnMayCloseFailed() { when(roleEditorWorkflow.isDirty()).thenReturn(true); assertFalse(tested.onMayClose()); }