From a717a85a809d7cc2ecdcb4657ca42caf0ec7f5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Wed, 16 Sep 2020 17:33:39 +0200 Subject: [PATCH] Created test GroupServiceTest.java. It contains createAndDeleteGroup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Woźniak --- .../plannaplan/services/GroupServiceTest.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 buisnesslogic/src/test/java/com/plannaplan/services/GroupServiceTest.java diff --git a/buisnesslogic/src/test/java/com/plannaplan/services/GroupServiceTest.java b/buisnesslogic/src/test/java/com/plannaplan/services/GroupServiceTest.java new file mode 100644 index 0000000..c6299cb --- /dev/null +++ b/buisnesslogic/src/test/java/com/plannaplan/services/GroupServiceTest.java @@ -0,0 +1,37 @@ +package com.plannaplan.services; + +import static org.junit.Assert.assertTrue; + +import com.plannaplan.entities.Groups; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +@ContextConfiguration +public class GroupServiceTest { + + @Autowired + private GroupService groupService; + + @Test + public void createAndDeleteGroup() { + Groups group; + int startAmmount = this.groupService.getGroupsAmmount(); + + //Create group + group = new Groups(); + group.setRoom("A1"); + groupService.save(group); + assertTrue(this.groupService.getGroupsAmmount() > startAmmount); + + // Delete course + groupService.delete(group); + assertTrue(this.groupService.getGroupsAmmount() == startAmmount); + } +}