use of com.paypal.invoices.invoicesextract.model.AccountingDocumentModel in project mirakl-hyperwallet-connector by paypal.
the class MiraklShopToAccountingModelConverterTest method convert_shouldReturnInvoiceModelBasedOnValuesOfMiraklShop.
@Test
void convert_shouldReturnInvoiceModelBasedOnValuesOfMiraklShop() {
when(miraklShopMock.getId()).thenReturn(SHOP_ID);
final List<MiraklAdditionalFieldValue> miraklAdditionalFieldValues = List.of(miraklAdditionalFieldValueOneMock);
when(miraklShopMock.getAdditionalFieldValues()).thenReturn(miraklAdditionalFieldValues);
doReturn(invoiceModelBuilderMock).when(testObj).getBuilder();
when(invoiceModelBuilderMock.shopId(SHOP_ID)).thenReturn(invoiceModelBuilderMock);
when(invoiceModelBuilderMock.destinationToken(miraklAdditionalFieldValues)).thenReturn(invoiceModelBuilderMock);
when(invoiceModelBuilderMock.hyperwalletProgram(miraklAdditionalFieldValues)).thenReturn(invoiceModelBuilderMock);
when(invoiceModelBuilderMock.build()).thenReturn(invoiceModelMock);
final AccountingDocumentModel result = testObj.convert(miraklShopMock);
verify(invoiceModelBuilderMock).destinationToken(miraklAdditionalFieldValues);
verify(invoiceModelBuilderMock).shopId(SHOP_ID);
assertThat(result).isEqualTo(invoiceModelMock);
}
Aggregations