Group capacity response places overload
This commit is contained in:
@ -78,4 +78,32 @@ public class GroupsMappersTest {
|
||||
assertTrue(response.get(1).getTakenPlaces() == 56);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldMapToCapacityResponseWithTakenPlace()
|
||||
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
||||
final Field reader = Groups.class.getDeclaredField("id");
|
||||
reader.setAccessible(true);
|
||||
|
||||
final Groups group1 = new Groups(150, "A4-1", null, 520, WeekDay.MONDAY,
|
||||
new Lecturer("krul.", "Wladyslaw", "Potocki"));
|
||||
final Groups group2 = new Groups(24, "A4-1", null, 520, WeekDay.MONDAY,
|
||||
new Lecturer("krul.", "Wladyslaw", "Potocki"));
|
||||
|
||||
reader.set(group1, Long.valueOf(0));
|
||||
reader.set(group2, Long.valueOf(1));
|
||||
|
||||
final HashMap<Long, Integer> placeMap = new HashMap<>();
|
||||
placeMap.put(Long.valueOf(0), 5);
|
||||
placeMap.put(Long.valueOf(1), 56);
|
||||
|
||||
final List<GroupWithCapacityResponse> response = GroupsMappers.mapToCapacityResponse(List.of(group1, group2),
|
||||
placeMap);
|
||||
|
||||
assertTrue(response.size() == 2);
|
||||
assertTrue(response.get(0).getTakenPlaces() == 5);
|
||||
assertTrue(response.get(0).getCapacity() == 150);
|
||||
assertTrue(response.get(1).getTakenPlaces() == 56);
|
||||
assertTrue(response.get(1).getCapacity() == 24);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user