Buisness logic tests

This commit is contained in:
Filip Izydorczyk 2020-09-24 17:44:23 +02:00
parent 694fe74690
commit 3d1269037b

View File

@ -7,6 +7,11 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import com.plannaplan.TestApplication;
import com.plannaplan.models.ConfigData;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -18,9 +23,27 @@ public class ConfiguratorServiceTest {
@Autowired
ConfiguratorService configuratorService;
@Autowired
private CourseService courseService;
@Autowired
private GroupService groupService;
@Autowired
private LecturerService lecturerService;
@Test
public void shouldImportDataToDataBase() {
final InputStream inputStream = getClass().getClassLoader()
.getResourceAsStream(TestApplication.TEST_CONFIG_FILE);
final ConfigData data = new ConfigData(null, null, inputStream);
this.configuratorService.config(data);
int courses_ammount = this.courseService.getCoursesAmmount();
int groups_ammount = this.groupService.getGroupsAmmount();
int lecturers_ammount = this.lecturerService.getLecturersAmmount();
assertTrue(courses_ammount > 0 && groups_ammount > 0 && lecturers_ammount > 0);
}
}