settings.setTimeslotsPerDay(slotsPerDay);
settings.setNumberOfDays(slotsPerWeek / slotsPerDay);
Feature loc1Feature = newFeature("special");
Assignment ass1 = newAssignment("1", -1, 2);
ass1.getEvent().addFeature(loc1Feature);
Assignment ass2 = newAssignment("2", -1, 2);
Assignment ass3 = newAssignment("3", -1, 1);
ConflictMatrix conflictMatrix = new ConflictMatrix(slotsPerWeek, slotsPerDay);
conflictMatrix.initFromResources(newResources(Arrays.asList(ass1), Arrays.asList(ass2), Arrays.asList(ass3)));
final Location loc1 = new Location(5);
final Location loc2 = new Location(10);
loc1.addFeature(loc1Feature);
List locations = Arrays.asList(loc1, loc2);
periode = newPeriod(slotsPerWeek, locations, conflictMatrix);
periode.setRandom(new Random());
assertEquals(true, periode.add(ass3, 2));
assertEquals(true, periode.add(ass2, 1));
assertEquals(loc2, ass3.getLocation());
assertEquals(loc1, ass2.getLocation());
// event with duration==1 cannot move larger event (ass2)
assertEquals(false, periode.add(ass1, 0));
assertNotNull(periode.remove(ass3));
assertNotNull(periode.remove(ass2));
ass3.getEvent().addFeature(loc1Feature);
assertEquals(true, periode.add(ass3, 2));
assertEquals(true, periode.add(ass2, 1));
assertEquals(loc1, ass3.getLocation());
assertEquals(loc2, ass2.getLocation());
}