Added 2nd tour accepting test

This commit is contained in:
Filip Izydorczyk 2021-01-16 15:32:50 +01:00
parent 707e26e082
commit 2cfe0e7551

View File

@ -131,6 +131,34 @@ public class AssignmentServiceTest {
}
@Test
@DirtiesContext(methodMode = MethodMode.BEFORE_METHOD)
public void shouldAcceptTwoTours() throws InterruptedException {
final Groups group = this.groupService.save(new Groups(5, null, null, 840, WeekDay.MONDAY, null));
final Groups group2 = this.groupService.save(new Groups(5, null, null, 840, WeekDay.MONDAY, null));
User user = this.userService.save(new User(null, null,
"shouldNotAcceptForOnePerson-" + UUID.randomUUID().toString() + "@AssignmentService.test", null,
UserRoles.STUDENT, 234));
final Commision com = this.comServie.save(new Commision(user));
this.service.save(new Assignment(group, com));
this.service.callAcceptAlgorythm();
user = this.userService.getById(user.getId()).get();
assertTrue(user.getStudentRegisteredGrups().size() == 1);
this.service.save(new Assignment(group2, com));
this.service.callAcceptAlgorythm();
user = this.userService.getById(user.getId()).get();
assertTrue(user.getStudentRegisteredGrups().size() == 2);
}
private void addAssignmentToCommision(Commision com) {
Assignment a = new Assignment(null, com);
this.service.save(a);