### Question:
TrainingSetManager { public boolean releaseTrainingSet(long id, boolean finished) { AssignedTrainingSet assignedTrainingSet = getAssignedTrainingSet(id); if (assignedTrainingSets.stream().anyMatch(o -> o.getClientID() == id) && !finished && assignedTrainingSet != null) { trainingSets.add(assignedTrainingSet.getTrainingSet()); } return assignedTrainingSets.remove(assignedTrainingSet); } TrainingSetManager(); synchronized void addTrainingSet(TrainingSet trainingSet); void addTrainingSets(Collection<TrainingSet> trainingSets); synchronized TrainingSet acquireTrainingSet(long id); boolean releaseTrainingSet(long id, boolean finished); void reset();  }### Answer:
@Test public void releaseTrainingSet() { TrainingSetManager manager = ManagerRegistry.getTrainingSetManager(); manager.reset(); fillTrainingSetManager(manager, 2); TrainingSet trainingSet = manager.acquireTrainingSet(0); assertThat(trainingSet).isNotNull(); manager.releaseTrainingSet(0, true); TrainingSet trainingSet2 = manager.acquireTrainingSet(0); assertThat(trainingSet).isNotEqualTo(trainingSet2); assertThat(manager.releaseTrainingSet(0, false)).isTrue(); TrainingSet trainingSet3 = manager.acquireTrainingSet(0); assertThat(trainingSet2).isEqualTo(trainingSet3); }