package com.braintree.customersupportbackoffice.editor;

import com.braintreegateway.Transaction;
import de.hybris.bootstrap.annotations.UnitTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;


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

    private static final String VALUE_TYPE = "java.lang.Enum(BraintreeTransactionType)";

    @Mock
    Object initialValue;
    @InjectMocks
    private BrainTreeTransactionTypeEditor editor;


    @Test
    public void shouldReturnTypeCollection() {
        List<Object> result  = editor.getAllValues(VALUE_TYPE, initialValue);

        assertNotNull(result);
        assertFalse(result.isEmpty());
        assertEquals(result.get(0), Transaction.Type.CREDIT.toString().toUpperCase());
        assertEquals(result.get(1), Transaction.Type.SALE.toString().toUpperCase());
        assertEquals(result.get(2), Transaction.Type.UNRECOGNIZED.toString().toUpperCase());
    }
}
