Vhevkpoint implemented but stiull some errors

This commit is contained in:
BuildTools
2020-11-30 13:22:53 +01:00
parent 082b30133c
commit 78ed2f75f3
3 changed files with 53 additions and 5 deletions

View File

@ -81,6 +81,35 @@ public class GroupsMappersTest {
assertTrue(response.getClasses().get(0).getTakenPlaces() == 21);
}
@Test
public void shouldMapToGetCourseCapacityGroupsResponseWithTakenPlaces() throws NoSuchFieldException,
SecurityException, IllegalArgumentException, IllegalAccessException {
final Field reader = Groups.class.getDeclaredField("id");
reader.setAccessible(true);
final List<Groups> groups = Arrays.asList(
new Groups(150, "A4-1", null, 520, WeekDay.MONDAY,
new Lecturer("krul.", "Wladyslaw", "Potocki")),
new Groups(24, "A4-1", null, 520, WeekDay.MONDAY,
new Lecturer("krul.", "Wladyslaw", "Potocki")));
reader.set(groups.get(0), Long.valueOf(0));
reader.set(groups.get(1), Long.valueOf(1));
final HashMap<Long, Integer> placeMap = new HashMap<>();
placeMap.put(Long.valueOf(0), 0);
placeMap.put(Long.valueOf(1), 21);
final CourseWithGroupsResponse<GroupWithCapacityResponse> response = GroupsMappers
.mapToGetCourseGroupsWithCapacityResponse(groups, placeMap);
assertTrue(response.getClasses().size() == 1);
assertTrue(response.getLectures().size() == 1);
assertTrue(response.getLectures().get(0).getTakenPlaces() == 0);
assertTrue(response.getLectures().get(0).getCapacity() == 150);
assertTrue(response.getClasses().get(0).getTakenPlaces() == 21);
assertTrue(response.getClasses().get(0).getCapacity() == 24);
}
@Test
public void shouldMapToDefaultResponseWithTakenPlace() throws NoSuchFieldException, SecurityException,
IllegalArgumentException, IllegalAccessException {