Skip to content

Commit

Permalink
fix: adapt test to repositoryType feature
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaDel03 committed Oct 15, 2024
1 parent 68ddd66 commit f1248b9
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
package it.finanze.sanita.fse2.ms.iniclient;

import static it.finanze.sanita.fse2.ms.iniclient.controller.impl.IniOperationCTL.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
Expand All @@ -23,6 +24,7 @@

import javax.xml.bind.JAXBException;

import it.finanze.sanita.fse2.ms.iniclient.controller.impl.IniOperationCTL;
import it.finanze.sanita.fse2.ms.iniclient.service.IConfigSRV;
import org.bson.Document;
import org.junit.jupiter.api.AfterEach;
Expand Down Expand Up @@ -89,7 +91,7 @@ void dropCollection() {
void publishSuccessTest() {
Mockito.when(iniClient.sendPublicationData(any(DocumentEntryDTO.class), any(SubmissionSetEntryDTO.class), any(JWTTokenDTO.class)))
.thenReturn(new RegistryResponseType());
IniResponseDTO response = iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.PUBLISH,null);
IniResponseDTO response = iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.PUBLISH,null, VALID_REPOSITORY_TYPES.get(0));
assertTrue(response.getEsito());
assertNull(response.getMessage());
}
Expand All @@ -99,7 +101,7 @@ void publishSuccessTest() {
void publishErrorTest() {
Mockito.when(iniClient.sendPublicationData(any(DocumentEntryDTO.class), any(SubmissionSetEntryDTO.class), any(JWTTokenDTO.class)))
.thenThrow(new BusinessException(""));
assertThrows(BusinessException.class, () -> iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.PUBLISH,null));
assertThrows(BusinessException.class, () -> iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.PUBLISH,null, VALID_REPOSITORY_TYPES.get(0)));
}

@Test
Expand All @@ -108,7 +110,7 @@ void publishErrorResponseTest() {
RegistryResponseType registryResponseType = TestUtility.mockRegistryError();
Mockito.when(iniClient.sendPublicationData(any(DocumentEntryDTO.class), any(SubmissionSetEntryDTO.class), any(JWTTokenDTO.class)))
.thenReturn(registryResponseType);
IniResponseDTO response = iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.PUBLISH,null);
IniResponseDTO response = iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.PUBLISH,null, VALID_REPOSITORY_TYPES.get(0));
assertFalse(response.getEsito());
assertNotNull(response.getMessage());
}
Expand All @@ -119,7 +121,7 @@ void replaceSuccessTest() {
RegistryResponseType registryResponseType = TestUtility.mockRegistrySuccess();
Mockito.when(iniClient.sendReplaceData(any(), any(), any(),any()))
.thenReturn(registryResponseType);
IniResponseDTO response = iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.REPLACE,null);
IniResponseDTO response = iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.REPLACE,null, VALID_REPOSITORY_TYPES.get(0));
assertTrue(response.getEsito());
assertNull(response.getMessage());
}
Expand All @@ -131,7 +133,7 @@ void replaceErrorTest() {
ReplaceRequestDTO requestDTO = new ReplaceRequestDTO();
requestDTO.setRiferimentoIni("identificativoDoc");
requestDTO.setWorkflowInstanceId(TestConstants.TEST_WII);
assertThrows(BusinessException.class, () -> iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.REPLACE,null));
assertThrows(BusinessException.class, () -> iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.REPLACE,null, VALID_REPOSITORY_TYPES.get(0)));
}

@Test
Expand All @@ -143,7 +145,7 @@ void replaceErrorResponseTest() {
ReplaceRequestDTO requestDTO = new ReplaceRequestDTO();
requestDTO.setRiferimentoIni("identificativoDoc");
requestDTO.setWorkflowInstanceId(TestConstants.TEST_WII);
IniResponseDTO response = iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.REPLACE,null);
IniResponseDTO response = iniInvocationSRV.publishOrReplaceOnIni(TestConstants.TEST_WII, ProcessorOperationEnum.REPLACE,null, VALID_REPOSITORY_TYPES.get(0));
assertFalse(response.getEsito());
assertNotNull(response.getMessage());
}
Expand Down

0 comments on commit f1248b9

Please sign in to comment.