package com.braintree.actions.order;

import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.orderprocessing.events.AuthorizationFailedEvent;
import de.hybris.platform.orderprocessing.model.OrderProcessModel;
import de.hybris.platform.servicelayer.event.EventService;
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.mockito.Matchers.any;
import static org.mockito.Mockito.verify;

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

    @Mock
    private EventService eventService;

    @InjectMocks
    private BrainTreeSendAuthorizationFailedNotificationAction sendAuthorizationFailedNotification;

    @Test
    public void testExecuteActionOrderProcessModel() {
        final OrderProcessModel process = new OrderProcessModel();
        sendAuthorizationFailedNotification.executeAction(process);

        verify(eventService).publishEvent(any(AuthorizationFailedEvent.class));
    }

}
