use of org.acme.schooltimetabling.message.SolverResponse in project optaplanner-quickstarts by kiegroup.
the class TimeTableMessagingHandlerTest method solvingThrowsException.
@Test
@Timeout(TEST_TIMEOUT_SECONDS)
void solvingThrowsException() {
long problemId = 10L;
// OptaPlanner doesn't tolerate a null planningId.
TimeTable timeTableWithIncorrectLesson = new TimeTable(Arrays.asList(new Timeslot(1L, DayOfWeek.MONDAY, LocalTime.NOON, LocalTime.NOON.plusMinutes(30))), Arrays.asList(new Room(1L, "room-A")), Arrays.asList(new Lesson(null, "Math", "A. Touring", "10th grade")));
sendSolverRequest(new SolverRequest(problemId, timeTableWithIncorrectLesson));
SolverResponse solverResponse = receiveSolverResponse(MESSAGE_RECEIVE_TIMEOUT_SECONDS);
assertThat(SolverResponse.ResponseStatus.FAILURE == solverResponse.getResponseStatus());
assertThat(problemId == solverResponse.getProblemId());
assertThat(solverResponse.getErrorInfo().getExceptionClassName()).isEqualTo(IllegalArgumentException.class.getName());
assertThat(solverResponse.getErrorInfo().getExceptionMessage()).startsWith("The planningId (null)");
}
Aggregations