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

import com.braintree.enums.BraintreeLocation;
import com.braintree.enums.BraintreePayPalColor;
import com.braintree.enums.BraintreePayPalLabel;
import com.braintree.enums.BraintreePayPalLayout;
import com.braintree.enums.BraintreePayPalShape;
import com.braintree.hybris.data.PayPalButtonStyleData;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.core.model.BraintreePayPalStylesConfigurationModel;
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.*;
import static org.mockito.Mockito.when;

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

    private static final int HEIGHT = 55;
    private static final String COLOR = "gold";
    private static final String LOCATION = "cart";
    private static final String LABEL = "pay";
    private static final String SHAPE = "pill";
    private static final String LAYOUT = "vertical";
    @Mock
    private BraintreePayPalStylesConfigurationModel model;
    @InjectMocks
    private BraintreePayPalStyleConfigurationPopulator unit;

    @Test
    public void shouldPopulatePayPalStyleConfiguration(){
        PayPalButtonStyleData data = new PayPalButtonStyleData();

        when(model.getColor()).thenReturn(BraintreePayPalColor.GOLD);
        when(model.getLocation()).thenReturn(BraintreeLocation.CART);
        when(model.getLabel()).thenReturn(BraintreePayPalLabel.PAY);
        when(model.getShape()).thenReturn(BraintreePayPalShape.PILL);
        when(model.getLayout()).thenReturn(BraintreePayPalLayout.VERTICAL);
        when(model.isTagline()).thenReturn(true);
        when(model.getHeight()).thenReturn(HEIGHT);

        unit.populate(model, data);

        assertEquals(COLOR, data.getColor());
        assertEquals(LOCATION, data.getLocation());
        assertEquals(LABEL, data.getLabel());
        assertEquals(SHAPE, data.getShape());
        assertEquals(LAYOUT, data.getLayout());
        assertTrue(data.isTagline());
        assertEquals(HEIGHT, data.getHeight());

    }

}