From 3d1269037b52f9eec905311be1a8eb5e81962f1c Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Thu, 24 Sep 2020 17:44:23 +0200 Subject: [PATCH] Buisness logic tests --- .../services/ConfiguratorServiceTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/buisnesslogic/src/test/java/com/plannaplan/services/ConfiguratorServiceTest.java b/buisnesslogic/src/test/java/com/plannaplan/services/ConfiguratorServiceTest.java index e23b7a5..0b1a2b2 100755 --- a/buisnesslogic/src/test/java/com/plannaplan/services/ConfiguratorServiceTest.java +++ b/buisnesslogic/src/test/java/com/plannaplan/services/ConfiguratorServiceTest.java @@ -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); } }