Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
giulia-tremolada committed Nov 14, 2024
1 parent 07e6ebb commit fb4876f
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void toProductRoleMappingsResource_fromEntry_null() {
@Test
void toProductRoleMappingsResource_fromEntry_nullRoles() {
// given
Map.Entry<PartyRole, ProductRoleInfo> input = Map.entry(PartyRole.DELEGATE, mockInstance(new ProductRoleInfo()));
Map.Entry<PartyRole, ProductRoleInfo> input = Map.entry(PartyRole.OPERATOR, mockInstance(new ProductRoleInfo()));
// when
ProductRoleMappingsResource output = ProductsMapper.toProductRoleMappingsResource(input);
// then
Expand All @@ -118,7 +118,7 @@ void toProductRoleMappingsResource_fromEntry_nullRoles() {


@Test
void toProductRoleMappingsResource_fromEntry_notNull() {
void toProductRoleMappingsResource_fromEntry_notNull_ADMIN() {
// given
ProductRoleInfo productRoleInfo = mockInstance(new ProductRoleInfo(), "setRoles");
productRoleInfo.setRoles(List.of(mockInstance(new ProductRole())));
Expand All @@ -134,6 +134,23 @@ void toProductRoleMappingsResource_fromEntry_notNull() {
assertEquals(input.getValue().isMultiroleAllowed(), output.isMultiroleAllowed());
}

@Test
void toProductRoleMappingsResource_fromEntry_notNull_ADMIN_EA() {
// given
ProductRoleInfo productRoleInfo = mockInstance(new ProductRoleInfo(), "setRoles");
productRoleInfo.setRoles(List.of(mockInstance(new ProductRole())));
Map.Entry<PartyRole, ProductRoleInfo> input = Map.entry(PartyRole.ADMIN_EA, productRoleInfo);
// when
ProductRoleMappingsResource output = ProductsMapper.toProductRoleMappingsResource(input);
// then
assertNotNull(output);
assertNotNull(output.getProductRoles());
assertEquals(productRoleInfo.getRoles().size(), output.getProductRoles().size());
assertEquals(input.getKey().name(), output.getPartyRole());
assertEquals(SelfCareAuthority.ADMIN_EA, output.getSelcRole());
assertEquals(input.getValue().isMultiroleAllowed(), output.isMultiroleAllowed());
}


@Test
void toProductRoleMappingsResource_fromMap_null() {
Expand Down

0 comments on commit fb4876f

Please sign in to comment.