backend/buisnesslogic/src/test/java/com/plannaplan/services/LecturerServiceTest.java
2020-09-25 16:43:24 +02:00

33 lines
1.0 KiB
Java
Executable File

package com.plannaplan.services;
import static org.junit.Assert.assertTrue;
import com.plannaplan.entities.Lecturer;
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 LecturerServiceTest {
@Autowired
private LecturerService lecturerService;
@Test
public void createAndDeleteLecturer() {
int startAmmount = this.lecturerService.getLecturersAmmount();
Lecturer lecturer = new Lecturer("prof.", "Tomasz", "Kowalski");
lecturerService.save(lecturer);
assertTrue(this.lecturerService.getLecturersAmmount() > startAmmount);
lecturerService.delete(lecturer);
assertTrue(this.lecturerService.getLecturersAmmount() == startAmmount);
}
}