Skip to content

Commit

Permalink
test SetEnabledBpmnAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ElisKina-dev committed Jul 29, 2024
1 parent 31a16fb commit 580533c
Showing 1 changed file with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
import it.gov.pagopa.atmlayer.service.model.entity.BpmnVersion;
import it.gov.pagopa.atmlayer.service.model.entity.BpmnVersionPK;
import it.gov.pagopa.atmlayer.service.model.entity.ResourceFile;
import it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorType;
import it.gov.pagopa.atmlayer.service.model.enumeration.DeployableResourceType;
import it.gov.pagopa.atmlayer.service.model.enumeration.S3ResourceTypeEnum;
import it.gov.pagopa.atmlayer.service.model.enumeration.StatusEnum;
import it.gov.pagopa.atmlayer.service.model.enumeration.*;
import it.gov.pagopa.atmlayer.service.model.exception.AtmLayerException;
import it.gov.pagopa.atmlayer.service.model.mapper.BpmnVersionMapper;
import it.gov.pagopa.atmlayer.service.model.model.BpmnDTO;
Expand All @@ -34,8 +31,7 @@
import java.security.NoSuchAlgorithmException;
import java.util.*;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;

Expand All @@ -59,6 +55,23 @@ public void setup() {
MockitoAnnotations.openMocks(this);
}

@Test
void testSetEnabledBpmnAttributes() {
BpmnVersionPK pk = new BpmnVersionPK();
BpmnVersion bpmnVersion = new BpmnVersion();
bpmnVersion.setSha256("sha256value" + UtilityValues.DISABLED_FLAG.getValue());

when(bpmnVersionRepoMock.findById(pk)).thenReturn(Uni.createFrom().item(bpmnVersion));
when(bpmnVersionRepoMock.persist(bpmnVersion)).thenReturn(Uni.createFrom().item(bpmnVersion));

Uni<BpmnVersion> resultUni = bpmnVersionServiceImpl.setEnabledBpmnAttributes(pk);

BpmnVersion result = resultUni.subscribe().asCompletionStage().join();
assertNotNull(result);
assertTrue(result.getEnabled());
assertEquals("sha256value", result.getSha256());
}

@Test
void testUndeployWithNonExistingUUID() {
UUID uuid = UUID.randomUUID();
Expand Down

0 comments on commit 580533c

Please sign in to comment.