diff --git a/pom.xml b/pom.xml index 69b8e402..7669c4ae 100644 --- a/pom.xml +++ b/pom.xml @@ -150,23 +150,64 @@ org.jacoco jacoco-maven-plugin 0.8.2 - - - ch/ethz/seb/sebserver/* - - - - - - - default-prepare-agent + prepare-agent prepare-agent + + report + prepare-package + + report + + + + post-unit-test + test + + report + + + + target/jacoco.exec + + target/jacoco-ut + + + + + ch/ethz/seb/sebserver/* + + + ch/ethz/seb/sebserver/webservice/datalayer/batis/mapper/* + ch/ethz/seb/sebserver/webservice/datalayer/batis/model/* + + + target/jacoco.exec + + + + + + + + + + + + + + + + + + + @@ -312,14 +353,14 @@ - org.junit.jupiter - junit-jupiter-api - test + org.junit.jupiter + junit-jupiter-api + test - org.junit.jupiter - junit-jupiter-engine - test + org.junit.jupiter + junit-jupiter-engine + test org.springframework.boot diff --git a/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java b/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java index ea6c3c9f..6bf40d81 100644 --- a/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/gui/integration/UseCasesIntegrationTest.java @@ -11,6 +11,8 @@ package ch.ethz.seb.sebserver.gui.integration; import static org.junit.Assert.*; import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.springframework.core.annotation.Order; import org.springframework.test.context.jdbc.Sql; @@ -22,18 +24,29 @@ import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestServiceImpl; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.institution.ActivateInstitution; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.institution.GetInstitution; +import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.institution.GetInstitutionNames; import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.institution.NewInstitution; -@Sql(scripts = { "classpath:schema-test.sql", "classpath:data-test.sql" }) public class UseCasesIntegrationTest extends GuiIntegrationTest { + @BeforeAll + @Sql(scripts = { "classpath:schema-test.sql", "classpath:data-test.sql" }) + public void init() { + + } + + @AfterAll + @Sql(scripts = { "classpath:schema-test.sql", "classpath:data-test.sql" }) + public void cleanup() { + + } + @Test @Order(1) - public void bigUseCasesTest() { - - // ************************************* - // Use Case 1: SEB Administrator creates a new institution and activate this new institution + // ************************************* + // Use Case 1: SEB Administrator creates a new institution and activate this new institution + public void testUsecase1() { final RestServiceImpl restService = createRestServiceForUser( "admin", "admin", @@ -68,12 +81,30 @@ public class UseCasesIntegrationTest extends GuiIntegrationTest { assertEquals("Test Institution", institution.name); assertTrue(institution.active); - // ************************************* - // Use Case 2: SEB Administrator creates a new Institutional Administrator user for the - // newly created institution and activate this user + } - // TODO do as much use cases as possible within this integration test + @Test + @Order(2) + // ************************************* + // Use Case 2: SEB Administrator creates a new Institutional Administrator user for the + // newly created institution and activate this user + public void testUsecase2() { + final RestServiceImpl restService = createRestServiceForUser( + "admin", + "admin", + new GetInstitution(), + new GetInstitutionNames()); + + final String instId = restService.getBuilder(GetInstitutionNames.class) + .call() + .getOrThrow() + .stream() + .filter(inst -> "Test Institution".equals(inst.name)) + .findFirst() + .get().modelId; + + assertNotNull(instId); } }