56 lines
2.2 KiB
Java
Executable File
56 lines
2.2 KiB
Java
Executable File
package com.plannaplan.responses.models;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
import com.plannaplan.entities.Assignment;
|
|
import com.plannaplan.entities.Groups;
|
|
import com.plannaplan.entities.Lecturer;
|
|
import com.plannaplan.types.GroupType;
|
|
import com.plannaplan.types.WeekDay;
|
|
|
|
import org.junit.Test;
|
|
|
|
public class GroupWithCapacityResponseTest {
|
|
@Test
|
|
public void shouldMapAssignmentClassToResponse() {
|
|
final Assignment assignment = new Assignment(
|
|
new Groups(42, "A4-1", null, 520, WeekDay.MONDAY, new Lecturer("krul.", "Wladyslaw", "Potocki")), null);
|
|
|
|
final GroupWithCapacityResponse response = new GroupWithCapacityResponse(assignment);
|
|
assertTrue(response.getCapacity() == 42);
|
|
assertTrue(response.getDay() == 0);
|
|
assertTrue(response.getLecturer().equals("krul. Wladyslaw Potocki"));
|
|
assertTrue(response.getRoom().equals("A4-1"));
|
|
assertTrue(response.getTime().equals("8.40"));
|
|
assertTrue(response.getType() == GroupType.CLASS);
|
|
}
|
|
|
|
@Test
|
|
public void shouldMapGroupClassToResponse() {
|
|
final Groups group = new Groups(42, "A4-1", null, 520, WeekDay.MONDAY,
|
|
new Lecturer("krul.", "Wladyslaw", "Potocki"));
|
|
|
|
final GroupWithCapacityResponse response = new GroupWithCapacityResponse(group);
|
|
assertTrue(response.getCapacity() == 42);
|
|
assertTrue(response.getDay() == 0);
|
|
assertTrue(response.getLecturer().equals("krul. Wladyslaw Potocki"));
|
|
assertTrue(response.getRoom().equals("A4-1"));
|
|
assertTrue(response.getTime().equals("8.40"));
|
|
assertTrue(response.getType() == GroupType.CLASS);
|
|
}
|
|
|
|
@Test
|
|
public void shouldMapEmptyGroupClassToResponse() {
|
|
final Groups group = new Groups();
|
|
|
|
final GroupWithCapacityResponse response = new GroupWithCapacityResponse(group);
|
|
assertTrue(response.getCapacity() == 0);
|
|
assertTrue(response.getDay() == -1);
|
|
assertTrue(response.getLecturer().equals(""));
|
|
assertTrue(response.getRoom().equals(""));
|
|
assertTrue(response.getTime().equals("0.00"));
|
|
assertTrue(response.getType() == null);
|
|
}
|
|
|
|
}
|