Created test GroupServiceTest.java. It contains createAndDeleteGroup
Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
parent
d5e32a487b
commit
a717a85a80
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user