generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SELC-5547] fix: Updated registry managers for ADE and INFOCAMERE
- Loading branch information
1 parent
c58e8c4
commit dc9e26a
Showing
11 changed files
with
236 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...oarding-ms/src/test/java/it/pagopa/selfcare/onboarding/entity/RegistryManagerADETest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package it.pagopa.selfcare.onboarding.entity; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.when; | ||
|
||
import io.quarkus.test.InjectMock; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.smallrye.mutiny.Uni; | ||
import io.smallrye.mutiny.helpers.test.UniAssertSubscriber; | ||
import it.pagopa.selfcare.onboarding.common.Origin; | ||
import it.pagopa.selfcare.onboarding.common.PartyRole; | ||
import it.pagopa.selfcare.onboarding.entity.registry.RegistryManagerADE; | ||
import it.pagopa.selfcare.onboarding.exception.InvalidRequestException; | ||
import java.util.List; | ||
import org.eclipse.microprofile.rest.client.inject.RestClient; | ||
import org.junit.jupiter.api.Test; | ||
import org.openapi.quarkus.party_registry_proxy_json.api.NationalRegistriesApi; | ||
import org.openapi.quarkus.party_registry_proxy_json.model.LegalVerificationResult; | ||
|
||
@QuarkusTest | ||
public class RegistryManagerADETest { | ||
|
||
@InjectMock | ||
@RestClient | ||
NationalRegistriesApi nationalRegistriesApi; | ||
|
||
@Test | ||
void retrieveInstitution() { | ||
Onboarding onboarding = createOnboarding(); | ||
RegistryManagerADE registryManagerADE = new RegistryManagerADE(onboarding, nationalRegistriesApi, "taxCode"); | ||
LegalVerificationResult legalVerificationResult = new LegalVerificationResult(); | ||
legalVerificationResult.setVerificationResult(true); | ||
when(nationalRegistriesApi.verifyLegalUsingGET(any(), any())).thenReturn(Uni.createFrom().item(legalVerificationResult)); | ||
Boolean result = registryManagerADE.retrieveInstitution(); | ||
assertTrue(result); | ||
} | ||
|
||
|
||
@Test | ||
void isNotValid() { | ||
Onboarding onboarding = createOnboarding(); | ||
RegistryManagerADE registryManagerADE = new RegistryManagerADE(onboarding, nationalRegistriesApi, "taxCode"); | ||
registryManagerADE.setResource(false); | ||
UniAssertSubscriber<Boolean> subscriber = registryManagerADE.isValid() | ||
.subscribe().withSubscriber(UniAssertSubscriber.create()); | ||
subscriber.assertFailedWith(InvalidRequestException.class); | ||
} | ||
|
||
private Onboarding createOnboarding() { | ||
Onboarding onboarding = new Onboarding(); | ||
User user = new User(); | ||
user.setRole(PartyRole.MANAGER); | ||
user.setId("idManager"); | ||
onboarding.setUsers(List.of(user)); | ||
Institution institution = new Institution(); | ||
institution.setTaxCode("taxCode"); | ||
institution.setOrigin(Origin.ADE); | ||
onboarding.setInstitution(institution); | ||
return onboarding; | ||
} | ||
|
||
} |
Oops, something went wrong.