35 lines
1.2 KiB
Java
Executable File
35 lines
1.2 KiB
Java
Executable File
package com.plannaplan.responses.models;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
import java.lang.reflect.Field;
|
|
import java.util.Arrays;
|
|
|
|
import com.plannaplan.entities.Assignment;
|
|
import com.plannaplan.entities.Commision;
|
|
import com.plannaplan.entities.Groups;
|
|
import com.plannaplan.types.WeekDay;
|
|
|
|
import org.junit.Test;
|
|
|
|
public class CommisionWithGroupsResponseTest {
|
|
@Test
|
|
public void shouldMapCommisionToResponse()
|
|
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
|
|
final Field reader = Commision.class.getDeclaredField("assignments");
|
|
final Field groupReader = Groups.class.getDeclaredField("id");
|
|
reader.setAccessible(true);
|
|
groupReader.setAccessible(true);
|
|
|
|
final Commision com = new Commision(null);
|
|
final Groups group = new Groups(43, "BRAK", null, 840, WeekDay.MONDAY, null);
|
|
|
|
groupReader.set(group, Long.valueOf(8));
|
|
reader.set(com, Arrays.asList(new Assignment(group, com)));
|
|
|
|
final CommisionWithGroupsResponse comResponse = new CommisionWithGroupsResponse(com);
|
|
|
|
assertTrue(comResponse.getGroups().get(0) == 8);
|
|
}
|
|
}
|