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-5807] feat: Added fields for PSP template
- Loading branch information
1 parent
c828a22
commit a253eff
Showing
4 changed files
with
115 additions
and
8 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
82 changes: 82 additions & 0 deletions
82
...ing-functions/src/test/java/it/pagopa/selfcare/onboarding/utils/InstitutionUtilsTest.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,82 @@ | ||
package it.pagopa.selfcare.onboarding.utils; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import it.pagopa.selfcare.onboarding.common.InstitutionType; | ||
import it.pagopa.selfcare.onboarding.common.PartyRole; | ||
import it.pagopa.selfcare.onboarding.entity.Institution; | ||
import it.pagopa.selfcare.onboarding.entity.Onboarding; | ||
import it.pagopa.selfcare.onboarding.entity.User; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class InstitutionUtilsTest { | ||
|
||
@Test | ||
void getCurrentInstitutionTypeTest() { | ||
// given | ||
Onboarding onboarding = createDummyOnboarding(); | ||
|
||
// when | ||
String result = InstitutionUtils.getCurrentInstitutionType(onboarding); | ||
|
||
// then | ||
assertEquals("PSP", result); | ||
} | ||
|
||
@Test | ||
void getCurrentInstitutionTypeTest_shouldReturnDefault_whenInstitutionTypeIsNull() { | ||
// given | ||
Onboarding onboarding = createDummyOnboarding(); | ||
onboarding.getInstitution().setInstitutionType(null); | ||
|
||
// when | ||
String result = InstitutionUtils.getCurrentInstitutionType(onboarding); | ||
|
||
// then | ||
assertEquals("default", result); | ||
} | ||
|
||
@Test | ||
void getCurrentInstitutionTypeTest_shouldReturnDefault_whenInstitutionIsNotNull() { | ||
// given | ||
Onboarding onboarding = createDummyOnboarding(); | ||
onboarding.setInstitution(new Institution()); | ||
// when | ||
String result = InstitutionUtils.getCurrentInstitutionType(onboarding); | ||
|
||
// then | ||
assertEquals("default", result); | ||
} | ||
|
||
@Test | ||
void getCurrentInstitutionTypeTest_shouldReturnDefault_whenInstitutionIsNull() { | ||
// given | ||
Onboarding onboarding = createDummyOnboarding(); | ||
onboarding.setInstitution(null); | ||
// when | ||
String result = InstitutionUtils.getCurrentInstitutionType(onboarding); | ||
|
||
// then | ||
assertEquals("default", result); | ||
} | ||
|
||
private Onboarding createDummyOnboarding() { | ||
Onboarding onboarding = new Onboarding(); | ||
onboarding.setId(UUID.randomUUID().toString()); | ||
onboarding.setProductId("prod-pagopa"); | ||
|
||
Institution institution = new Institution(); | ||
institution.setTaxCode("taxCode"); | ||
institution.setSubunitCode("subunitCode"); | ||
institution.setInstitutionType(InstitutionType.PSP); | ||
onboarding.setInstitution(institution); | ||
|
||
User user = new User(); | ||
user.setId("actual-user-id"); | ||
user.setRole(PartyRole.MANAGER); | ||
onboarding.setUsers(List.of(user)); | ||
return onboarding; | ||
} | ||
} |
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