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

import com.braintree.enums.BraintreeGooglePaySize;
import com.braintree.enums.BraintreeGooglePayType;
import com.braintree.enums.BraintreeLocation;
import com.braintree.hybris.data.GooglePayButtonStyleData;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.core.model.BraintreeGooglePayStylesConfigurationModel;
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 BraintreeGooglePayStyleConfigurationPopulatorTest {
    private static final String LOCATION = "cart";
    private static final String TYPE = "pay";
    private static final String SIZE = "static";
    @Mock
    private BraintreeGooglePayStylesConfigurationModel model;
    @InjectMocks
    private BraintreeGooglePayStyleConfigurationPopulator unit;

    @Test
    public void shouldPopulateGooglePayConfiguration() {
        GooglePayButtonStyleData data = new GooglePayButtonStyleData();

        when(model.getType()).thenReturn(BraintreeGooglePayType.PAY);
        when(model.getSize()).thenReturn(BraintreeGooglePaySize.STATIC);
        when(model.getLocation()).thenReturn(BraintreeLocation.CART);

        unit.populate(model, data);

        assertEquals(TYPE, data.getType());
        assertEquals(SIZE, data.getSize());
        assertEquals(LOCATION, data.getLocation());
    }

}