@@ -0,0 +1,3193 @@
+package com.groupon.lex.metrics;%0A%0Aimport com.groupon.lex.metrics.api.ApiServer;%0Aimport com.groupon.lex.metrics.config.Configuration;%0Aimport com.groupon.lex.metrics.history.CollectHistory;%0Aimport com.groupon.lex.metrics.httpd.EndpointRegistration;%0Aimport java.util.stream.Stream;%0Aimport static org.hamcrest.Matchers.instanceOf;%0Aimport org.joda.time.DateTime;%0Aimport org.joda.time.DateTimeZone;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertSame;%0Aimport static org.junit.Assert.assertThat;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.Mockito;%0Aimport static org.mockito.Mockito.times;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class PipelineBuilderTest %7B%0A    @Mock%0A    private EndpointRegistration api;%0A    @Mock%0A    private CollectHistory history;%0A    @Mock%0A    private PipelineBuilder.PushProcessorSupplier pps;%0A    @Mock%0A    private PushProcessor pp;%0A%0A    @Before%0A    public void setup() throws Exception %7B%0A        when(pps.build(Mockito.any())).thenReturn(pp);%0A        when(history.streamReversed()).thenThrow(new UnsupportedOperationException());%0A        when(history.stream()).thenAnswer((invocation) -%3E Stream.empty());%0A        when(history.stream(Mockito.any(DateTime.class), Mockito.any(DateTime.class))).thenAnswer((invocation) -%3E Stream.empty());%0A        when(history.getEnd()).thenReturn(DateTime.now(DateTimeZone.UTC));%0A    %7D%0A%0A    @Test%0A    public void build() throws Exception %7B%0A        try (final PullProcessorPipeline pipeline = new PipelineBuilder(Configuration.DEFAULT)%0A                .build()) %7B%0A            assertThat(pipeline.getMetricRegistry().getApi(), instanceOf(ApiServer.class));%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void buildWithApi() throws Exception %7B%0A        try (final PullProcessorPipeline pipeline = new PipelineBuilder(Configuration.DEFAULT)%0A                .withApi(api)%0A                .build()) %7B%0A            assertSame(api, pipeline.getMetricRegistry().getApi());%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void buildWithHistoryAndApi() throws Exception %7B%0A        try (final PushProcessorPipeline pipeline = new PipelineBuilder(Configuration.DEFAULT)%0A                .withApi(api)%0A                .withHistory(history)%0A                .build(pps)) %7B%0A            assertSame(history, pipeline.getMetricRegistry().getHistory().get());%0A            assertSame(api, pipeline.getMetricRegistry().getApi());%0A        %7D%0A%0A        verify(api, times(1)).setHistory(Mockito.same(history));%0A    %7D%0A%0A    @Test%0A    public void buildWithHistory() throws Exception %7B%0A        try (final PushProcessorPipeline pipeline = new PipelineBuilder(Configuration.DEFAULT)%0A                .withHistory(history)%0A                .withCollectIntervalSeconds(15)%0A                .build(pps)) %7B%0A            assertSame(history, pipeline.getMetricRegistry().getHistory().get());%0A            assertThat(pipeline.getMetricRegistry().getApi(), instanceOf(ApiServer.class));%0A            assertEquals(15, pipeline.getIntervalSeconds());%0A        %7D%0A    %7D%0A%7D%0A

Add pipeline tests.