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 BrainTreeTransactionStatusEditorTest {

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

    @Mock
    Object initialValue;
    @InjectMocks
    private BrainTreeTransactionStatusEditor editor;


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

        assertNotNull(result);
        assertFalse(result.isEmpty());
        assertEquals(result.get(0), Transaction.Status.AUTHORIZATION_EXPIRED);
        assertEquals(result.get(1), Transaction.Status.AUTHORIZED);
        assertEquals(result.get(2), Transaction.Status.AUTHORIZING);
        assertEquals(result.get(3), Transaction.Status.FAILED);
        assertEquals(result.get(4), Transaction.Status.GATEWAY_REJECTED);
        assertEquals(result.get(5), Transaction.Status.PROCESSOR_DECLINED);
        assertEquals(result.get(6), Transaction.Status.SETTLED);
        assertEquals(result.get(7), Transaction.Status.SETTLEMENT_CONFIRMED);
        assertEquals(result.get(8), Transaction.Status.SETTLEMENT_DECLINED);
        assertEquals(result.get(9), Transaction.Status.SETTLEMENT_PENDING);
        assertEquals(result.get(10), Transaction.Status.SETTLING);
        assertEquals(result.get(11), Transaction.Status.SUBMITTED_FOR_SETTLEMENT);
        assertEquals(result.get(12), Transaction.Status.UNRECOGNIZED);
        assertEquals(result.get(13), Transaction.Status.VOIDED);
    }
}
