From 2cfe0e7551c90e8486120c9df57dba96956eb177 Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Sat, 16 Jan 2021 15:32:50 +0100 Subject: [PATCH] Added 2nd tour accepting test --- .../services/AssignmentServiceTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/buisnesslogic/src/test/java/com/plannaplan/services/AssignmentServiceTest.java b/buisnesslogic/src/test/java/com/plannaplan/services/AssignmentServiceTest.java index efe00fa..c3a8e4e 100755 --- a/buisnesslogic/src/test/java/com/plannaplan/services/AssignmentServiceTest.java +++ b/buisnesslogic/src/test/java/com/plannaplan/services/AssignmentServiceTest.java @@ -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);