### Question:
ReleaseTaskProblemFactChange implements ProblemFactChange<TaskAssigningSolution> { @Override public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { Task workingTask = scoreDirector.lookUpWorkingObjectOrReturnNull(task); if (workingTask == null || workingTask.getPreviousTaskOrUser() == null) { return; } TaskOrUser previousTaskOrUser = workingTask.getPreviousTaskOrUser(); Task nextTask = workingTask.getNextTask(); if (nextTask != null) { scoreDirector.beforeVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); nextTask.setPreviousTaskOrUser(previousTaskOrUser); scoreDirector.afterVariableChanged(nextTask, PREVIOUS_TASK_OR_USER); } scoreDirector.beforeVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); workingTask.setPreviousTaskOrUser(null); scoreDirector.afterVariableChanged(workingTask, PREVIOUS_TASK_OR_USER); if (workingTask.isPinned()) { scoreDirector.beforeProblemPropertyChanged(workingTask); workingTask.setPinned(false); scoreDirector.afterProblemPropertyChanged(workingTask); } scoreDirector.triggerVariableListeners(); } ReleaseTaskProblemFactChange(Task task); Task getTask(); @Override void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector);  }### Answer:
@Test public void doChangeNonPinnedTask() { workingTask.setPinned(false); doChange(); verifyCommonResults(); }
@Test public void doChangePinnedTask() { workingTask.setPinned(true); doChange(); verifyCommonResults(); verify(scoreDirector).beforeProblemPropertyChanged(workingTask); verify(workingTask).setPinned(false); verify(scoreDirector).afterProblemPropertyChanged(workingTask); }
@Test public void doChangeUnAssignedTask() { workingTask.setPreviousTaskOrUser(null); when(scoreDirector.lookUpWorkingObjectOrReturnNull(task)).thenReturn(workingTask); change.doChange(scoreDirector); verify(scoreDirector, never()).beforeVariableChanged(any(Task.class), anyString()); verify(scoreDirector, never()).afterVariableChanged(any(Task.class), anyString()); verify(scoreDirector, never()).beforeProblemPropertyChanged(any()); verify(scoreDirector, never()).afterProblemPropertyChanged(any()); verify(scoreDirector, never()).triggerVariableListeners(); }