Search in sources :

Example 1 with AccountingDocumentModel

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);
}
Also used : MiraklAdditionalFieldValue(com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue) AccountingDocumentModel(com.paypal.invoices.invoicesextract.model.AccountingDocumentModel) Test(org.junit.jupiter.api.Test)

Aggregations

MiraklAdditionalFieldValue (com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue)1 AccountingDocumentModel (com.paypal.invoices.invoicesextract.model.AccountingDocumentModel)1 Test (org.junit.jupiter.api.Test)1