package com.braintree.payment.local.methods.service.impl;


import com.braintree.payment.local.methods.dao.BraintreeLocalPaymentMethodsDao;
import de.hybris.bootstrap.annotations.UnitTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import static org.mockito.Mockito.verify;

@UnitTest
@RunWith(MockitoJUnitRunner.class)
public class DefaultBraintreeLocalLocalPaymentMethodsServiceTest {

    private static final String PAYMENT_ID = "testId";

    @Mock
    private BraintreeLocalPaymentMethodsDao braintreeLocalPaymentMethodsDao;

    @InjectMocks
    private DefaultBraintreeLocalLocalPaymentMethodsService unit;

    @Test
    public void getAllLocalPaymentMethodsShouldUseDaoMethodGetAll() {
        unit.getAllLocalPaymentMethods();
        verify(braintreeLocalPaymentMethodsDao).getAll();
    }

    @Test
    public void getCarByPaymentIdShouldUseDaoMethodGetCarByPaymentId() {
        unit.getCartByPaymentId(PAYMENT_ID);
        verify(braintreeLocalPaymentMethodsDao).getCarByPaymentId(PAYMENT_ID);
    }

    @Test
    public void getOrderByPaymentMethodNonceShouldUseDaoMethodGetOrderByPaymentMethodNonce() {
        unit.getOrderByPaymentMethodNonce(PAYMENT_ID);
        verify(braintreeLocalPaymentMethodsDao).getOrderByPaymentMethodNonce(PAYMENT_ID);
    }

    @Test
    public void getOrderByPaymentIdShouldUseDaoMethodGetOrderByPaymentId() {
        unit.getOrderByPaymentId(PAYMENT_ID);
        verify(braintreeLocalPaymentMethodsDao).getOrderByPaymentId(PAYMENT_ID);
    }

}
