### Question:
TrainingSetManager { public synchronized TrainingSet acquireTrainingSet(long id) { if (assignedTrainingSets.stream().noneMatch(o -> o.getClientID() == id)) { TrainingSet trainingSet = trainingSets.poll(); if (trainingSet == null) { trainingSet = getExpiredAssignedTrainingSet(); } if (trainingSet != null) { assignedTrainingSets.add(new AssignedTrainingSet(id, trainingSet, (long) trainingSet.getDuration() * TIME_MULTIPLIER_TO_FINISH_TRAINING * SEC_TO_NANO)); } } AssignedTrainingSet assignedTrainingSet = getAssignedTrainingSet(id); return assignedTrainingSet != null ? assignedTrainingSet.getTrainingSet() : null; } 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 acquireTrainingSet() { TrainingSetManager manager = new TrainingSetManager(); fillTrainingSetManager(manager, 10); TrainingSet set1 = manager.acquireTrainingSet(0); TrainingSet set2 = manager.acquireTrainingSet(0); assertThat(set1).isEqualTo(set2); set2 = manager.acquireTrainingSet(1); assertThat(set1).isNotEqualTo(set2); }