use of com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.
the class MiraklSellersExtractServiceImplCustomFieldsTest method updateUserToken_shouldUpdateValueForCustomFieldHwUserToken.
@DisplayName("Should Update Value for Custom Field 'hw-user-token'")
@Test
void updateUserToken_shouldUpdateValueForCustomFieldHwUserToken() {
when(hyperwalletUserMock.getToken()).thenReturn(TOKEN_VALUE);
when(hyperwalletUserMock.getClientUserId()).thenReturn("12345");
testObj.updateUserToken(hyperwalletUserMock);
verify(miraklMarketplacePlatformOperatorApiClientMock).updateShops(miraklUpdateShopsRequestCaptor.capture());
final MiraklUpdateShopsRequest miraklUpdateShopsRequest = miraklUpdateShopsRequestCaptor.getValue();
assertThat(miraklUpdateShopsRequest.getShops()).hasSize(1);
final MiraklUpdateShop shopToUpdate = miraklUpdateShopsRequest.getShops().get(0);
assertThat(shopToUpdate).hasFieldOrPropertyWithValue("shopId", 12345L);
assertThat(shopToUpdate.getAdditionalFieldValues()).hasSize(1);
final MiraklRequestAdditionalFieldValue additionalFieldValue = shopToUpdate.getAdditionalFieldValues().get(0);
assertThat(additionalFieldValue).isInstanceOf(MiraklSimpleRequestAdditionalFieldValue.class);
final MiraklSimpleRequestAdditionalFieldValue castedAdditionalFieldValue = (MiraklSimpleRequestAdditionalFieldValue) additionalFieldValue;
assertThat(castedAdditionalFieldValue.getCode()).isEqualTo("hw-user-token");
assertThat(castedAdditionalFieldValue.getValue()).isEqualTo(TOKEN_VALUE);
}
Aggregations