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() { int startAmmount = this.groupService.getGroupsAmmount(); Groups group = new Groups(); group.setRoom("A1"); groupService.save(group); assertTrue(this.groupService.getGroupsAmmount() > startAmmount); groupService.delete(group); assertTrue(this.groupService.getGroupsAmmount() == startAmmount); } }