@@ -0,0 +1,3546 @@
+package rotateit.service.github.label;%0A%0Aimport static org.mockito.BDDMockito.given;%0Aimport static org.mockito.BDDMockito.then;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.never;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.context.ApplicationContext;%0Aimport org.springframework.context.ApplicationEvent;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.context.event.ApplicationEventMulticaster;%0Aimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;%0Aimport rotateit.domain.github.label.LabelPayload;%0Aimport rotateit.domain.github.label.LabelReceivedEvent;%0Aimport rotateit.domain.github.label.event.factory.ReviewActionEventFactory;%0Aimport rotateit.domain.github.label.event.factory.ReviewActionEventFactoryProvider;%0A%0A@RunWith(SpringJUnit4ClassRunner.class)%0Apublic class OnOpenPullRequestLabelReceivedEventListenerTest %7B%0A%0A    private final LabelReceivedEvent labelReceivedEvent = mock(LabelReceivedEvent.class);%0A    private final LabelPayload labelPayload = mock(LabelPayload.class);%0A    private final ApplicationEvent eventToPublish = mock(ApplicationEvent.class);%0A    private final ReviewActionEventFactory eventFactory = mock(ReviewActionEventFactory.class);%0A    @Autowired%0A    private ReviewActionEventFactoryProvider factoryProvider;%0A    @Autowired%0A    private ApplicationEventMulticaster eventMulticaster;%0A    @Autowired%0A    private ApplicationContext publishingHelper;%0A    @Autowired%0A    private OnOpenPullRequestLabelReceivedEventListener onOpenPullRequestLabelReceivedEventListener;%0A%0A    @Test%0A    public void shouldBeConsumedAndPublishedByEventListenerIfLabelReceivedEventWasOnOpenPullRequest() %7B%0A        given(labelReceivedEvent.isPullRequestInOpenState()).willReturn(true);%0A        given(labelReceivedEvent.getSource()).willReturn(labelPayload);%0A        given(factoryProvider.factoryFor(labelReceivedEvent)).willReturn(eventFactory);%0A        given(eventFactory.createReviewActionEvent(labelPayload)).willReturn(eventToPublish);%0A%0A        publishingHelper.publishEvent(labelReceivedEvent);%0A%0A        then(factoryProvider).should().factoryFor(labelReceivedEvent);%0A        then(eventMulticaster).should().multicastEvent(eventToPublish);%0A    %7D%0A%0A    @Test%0A    public void shouldNotBeConsumedNorPublishedByEventListenerIfLabelReceivedEventWasOnClosedPullRequest() %7B%0A        given(labelReceivedEvent.isPullRequestInOpenState()).willReturn(false);%0A%0A        publishingHelper.publishEvent(labelReceivedEvent);%0A%0A        then(factoryProvider).should(never()).factoryFor(labelReceivedEvent);%0A        then(eventMulticaster).should(never()).multicastEvent(eventToPublish);%0A    %7D%0A%0A    @Configuration%0A    protected static class TestConfiguration %7B%0A        @Bean%0A        protected ReviewActionEventFactoryProvider factoryProvider() %7B%0A            return mock(ReviewActionEventFactoryProvider.class);%0A        %7D%0A%0A        @Bean%0A        protected ApplicationEventMulticaster eventMulticaster() %7B%0A            return mock(ApplicationEventMulticaster.class);%0A        %7D%0A%0A        @Bean%0A        protected OnOpenPullRequestLabelReceivedEventListener onOpenPullRequestLabelReceivedEventListener(%0A            ReviewActionEventFactoryProvider factoryProvider, ApplicationEventMulticaster eventMulticaster) %7B%0A            return new OnOpenPullRequestLabelReceivedEventListener(factoryProvider, eventMulticaster);%0A        %7D%0A    %7D%0A%7D%0A

Add test for OnOpenPullRequestLabelReceivedEventListener