package com.braintree.converters.populators.configuration;

import com.braintree.hybris.data.BraintreeConnectWithPayPalConfigurationData;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.core.model.BraintreeConnectWithPayPalConfigurationModel;
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.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;

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

    @Mock
    private BraintreeConnectWithPayPalConfigurationModel model;

    @InjectMocks
    private BraintreeConnectWithPayPalConfigurationPopulator unit;

    @Test
    public void shouldPopulateConnectWithPayPalConfiguration() {
        BraintreeConnectWithPayPalConfigurationData data = new BraintreeConnectWithPayPalConfigurationData();

        when(model.isEnable()).thenReturn(true);
        when(model.isAddPaymentMethodFlow()).thenReturn(true);
        when(model.isLinkUserAccount()).thenReturn(true);
        when(model.isLippAdditionalSecurity()).thenReturn(true);

        unit.populate(model, data);

        assertTrue(data.isEnable());
        assertTrue(data.isAddPaymentMethodFlow());
        assertTrue(data.isLinkUserAccount());
        assertTrue(data.isLippAdditionalSecurity());
    }
}