### Question:
GitPushEventProcessor implements GitEventProcessor { @Override public void processEvent(final GitEvent event) { if (!validateEvent(event)) { return; } log.debug("Processing git event: {}", event); if (!defaultBranch.equals(event.getReference())) { log.debug("Skipping non default branch: {}", event.getReference()); return; } fetchPipeline(event, apiClient) .ifPresent(pipeline -> ListUtils.emptyIfNull(event.getCommits()) .stream() .map(commit -> { final List<PipelineEvent> events = new ArrayList<>(); final List<String> updated = ListUtils.union( filterPaths(commit.getAdded()), filterPaths(commit.getModified())); buildEvent(commit, EventType.UPDATE, updated, pipeline.getId()).ifPresent(events::add); final List<String> deleted = filterPaths(commit.getRemoved()); buildEvent(commit, EventType.DELETE, deleted, pipeline.getId()).ifPresent(events::add); log.debug("Processing events: {}", events); return events; }) .filter(CollectionUtils::isNotEmpty) .flatMap(Collection::stream) .forEach(eventDao::createPipelineEvent)); } GitPushEventProcessor(final PipelineEventDao eventDao,
                                 final CloudPipelineAPIClient apiClient,
                                 final ObjectMapper objectMapper,
                                 @Value("${sync.pipeline-code.default-branch}") final String defaultBranch,
                                 @Value("${sync.pipeline-code.index.paths}") final String indexedPaths); @Override GitEventType supportedEventType(); @Override void processEvent(final GitEvent event);  }### Answer:
@Test void shouldProcessPushEventTest() throws IOException { Pipeline pipeline = new Pipeline(); pipeline.setId(1L); pipeline.setName(TEST_NAME); pipeline.setRepository(TEST_PATH); when(apiClient.loadPipelineByRepositoryUrl(anyString())).thenReturn(pipeline); gitPushEventProcessor.processEvent(gitEvent); LocalDateTime dateTime = LocalDateTime.now(); List<PipelineEvent> pipelineCodeEvents = eventDao.loadPipelineEventsByObjectType( PipelineEvent.ObjectType.PIPELINE_CODE, dateTime); assertEquals(1, pipelineCodeEvents.size()); PipelineEvent event = pipelineCodeEvents.get(0); Map<String, Object> map = objectMapper.readValue(event.getData(), new TypeReference<Map<String, Object>>(){}); assertAll("event", () -> assertEquals(PipelineEvent.ObjectType.PIPELINE_CODE, event.getObjectType()), () -> assertEquals(EventType.UPDATE, event.getEventType()), () -> assertEquals(GitEventType.push.name(), map.get("gitEventType")), () -> assertEquals(BRANCH, map.get("version")), () -> assertEquals(Collections.singletonList(COMMIT_FILE_PATH), map.get("paths"))); }