fixed tests regarding legal basis

This commit is contained in:
Timo 2021-01-19 17:31:18 +02:00
parent 07e4306496
commit 3480ce3851
3 changed files with 13 additions and 21 deletions

View File

@ -1,23 +1,19 @@
package com.iqser.red.service.redaction.report.v1.server;
import com.iqser.red.commons.spring.DefaultWebMvcConfiguration;
import com.iqser.red.service.redaction.report.v1.server.settings.RedactionReportSettings;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import com.iqser.red.commons.spring.DefaultWebMvcConfiguration;
import com.iqser.red.service.redaction.report.v1.server.client.LegalBasisMappingClient;
import com.iqser.red.service.redaction.report.v1.server.settings.RedactionReportSettings;
@EnableAsync
@EnableConfigurationProperties(RedactionReportSettings.class)
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class})
@Import(DefaultWebMvcConfiguration.class)
@EnableFeignClients(basePackageClasses = {LegalBasisMappingClient.class})
public class Application {
/**

View File

@ -1,17 +1,14 @@
package com.iqser.red.service.redaction.report.v1.server;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.iqser.red.service.configuration.v1.api.model.LegalBasisMapping;
import com.iqser.red.service.redaction.report.v1.api.model.MultiFileRedactionLog;
import com.iqser.red.service.redaction.report.v1.api.model.ReportResult;
import com.iqser.red.service.redaction.report.v1.server.client.LegalBasisMappingClient;
import com.iqser.red.service.redaction.report.v1.server.controller.RedactionReportController;
import com.iqser.red.service.redaction.v1.model.RedactionLog;
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.boot.test.mock.mockito.MockBean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.test.context.junit4.SpringRunner;
@ -19,7 +16,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import static org.mockito.Mockito.when;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@RunWith(SpringRunner.class)
@ -32,19 +28,9 @@ public class RedactionReportIntegrationTest {
@Autowired
private RedactionReportController redactionReportController;
@MockBean
private LegalBasisMappingClient legalBasisMappingClient;
@Test
public void testReportGeneration() throws IOException {
ClassPathResource legalBasisMappingResource = new ClassPathResource("files/LegalBasisMapping.json");
LegalBasisMapping legalBasisMapping = objectMapper.readValue(legalBasisMappingResource.getInputStream(), LegalBasisMapping.class);
when(legalBasisMappingClient.getLegalBasisMapping("123")).thenReturn(legalBasisMapping);
ClassPathResource redactionLogResource = new ClassPathResource("files/RedactedLog.txt");
RedactionLog redactionLog = objectMapper.readValue(redactionLogResource.getInputStream(), RedactionLog.class);

View File

@ -1 +1,11 @@
{"reasonByLegalBasis":{"Reg (EC) No 1107/2009 Art. 63 (2d)":"methods of analysis for impurities in the active substance as manufactured except for methods for impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant","Reg (EC) No 1107/2009 Art. 63 (2c)":"results of production batches of the active substance including impurities","Reg (EC) No 1107/2009 Art. 63 (2b)":"the specification of impurity of the active substance except for the impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant","Reg (EC) No 1107/2009 Art. 63 (2a)":"the method of manufacture","Reg (EC) No 1107/2009 Art. 63 (2g)":"names and addresses of persons involved in testing on vertebrate animals","Reg (EC) No 1107/2009 Art. 63 (2f)":"information on the complete composition of a plant protection product","Reg (EC) No 1107/2009 Art. 63 (2e)":"links between a producer or importer and the applicant or the authorisation holder"}}
{
"reasonByLegalBasis": {
"Reg (EC) No 1107/2009 Art. 63 (2d)": "methods of analysis for impurities in the active substance as manufactured except for methods for impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant",
"Reg (EC) No 1107/2009 Art. 63 (2c)": "results of production batches of the active substance including impurities",
"Reg (EC) No 1107/2009 Art. 63 (2b)": "the specification of impurity of the active substance except for the impurities that are considered to be toxicologically, ecotoxicologically or environmentally relevant",
"Reg (EC) No 1107/2009 Art. 63 (2a)": "the method of manufacture",
"Reg (EC) No 1107/2009 Art. 63 (2g)": "names and addresses of persons involved in testing on vertebrate animals",
"Reg (EC) No 1107/2009 Art. 63 (2f)": "information on the complete composition of a plant protection product",
"Reg (EC) No 1107/2009 Art. 63 (2e)": "links between a producer or importer and the applicant or the authorisation holder"
}
}