package com.braintree.converters.populators.configuration.style;

import com.braintree.enums.BraintreeApplePayColor;
import com.braintree.enums.BraintreeApplePayShape;
import com.braintree.enums.BraintreeApplePayType;
import com.braintree.enums.BraintreeLocation;
import com.braintree.hybris.data.ApplePayButtonStyleData;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.core.model.BraintreeApplePayStylesConfigurationModel;
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.assertEquals;
import static org.mockito.Mockito.when;

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

    private static final String COLOR = "white-outline";
    private static final String LOCATION = "cart";
    private static final String SHAPE = "pill";
    private static final String TYPE = "pay";
    @Mock
    private BraintreeApplePayStylesConfigurationModel model;

    @InjectMocks
    private BraintreeApplePayStyleConfigurationPopulator unit;

    @Test
    public void shouldPopulateApplePayStyleConfiguration() {
        ApplePayButtonStyleData data = new ApplePayButtonStyleData();

        when(model.getColor()).thenReturn(BraintreeApplePayColor.WHITE_OUTLINE);
        when(model.getLocation()).thenReturn(BraintreeLocation.CART);
        when(model.getShape()).thenReturn(BraintreeApplePayShape.PILL);
        when(model.getType()).thenReturn(BraintreeApplePayType.PAY);

        unit.populate(model, data);

        assertEquals(COLOR, data.getColor());
        assertEquals(LOCATION, data.getLocation());
        assertEquals(SHAPE, data.getShape());
        assertEquals(TYPE, data.getType());
    }

}