@@ -0,0 +1,2225 @@
+package com.groupon.lex.metrics.timeseries.expression;%0A%0Aimport com.groupon.lex.metrics.MetricValue;%0Aimport com.groupon.lex.metrics.timeseries.TimeSeriesMetricDeltaSet;%0Aimport com.groupon.lex.metrics.timeseries.TimeSeriesMetricExpression;%0Aimport java.util.stream.Collectors;%0Aimport java.util.stream.IntStream;%0Aimport static org.junit.Assert.assertEquals;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class PercentileAggregateExpressionTest %7B%0A    @Mock%0A    private Context%3C?%3E ctx;%0A%0A    @Test%0A    public void exactTest() throws Exception %7B%0A        assertEquals(new TimeSeriesMetricDeltaSet(MetricValue.fromDblValue(50)), create(50, 101).apply(ctx));%0A        assertEquals(new TimeSeriesMetricDeltaSet(MetricValue.fromDblValue(99)), create(99, 101).apply(ctx));%0A        assertEquals(new TimeSeriesMetricDeltaSet(MetricValue.fromDblValue(1)), create(50, 3).apply(ctx));%0A    %7D%0A%0A    @Test%0A    public void inexactTest() throws Exception %7B%0A        assertEquals(new TimeSeriesMetricDeltaSet(MetricValue.fromDblValue(49.5)), create(50, 100).apply(ctx));%0A        assertEquals(new TimeSeriesMetricDeltaSet(MetricValue.fromDblValue(0.5)), create(50, 2).apply(ctx));%0A    %7D%0A%0A    @Test%0A    public void ceilTest() throws Exception %7B%0A        assertEquals(new TimeSeriesMetricDeltaSet(MetricValue.fromDblValue(17)), create(100, 18).apply(ctx));%0A    %7D%0A%0A    @Test%0A    public void floorTest() throws Exception %7B%0A        assertEquals(new TimeSeriesMetricDeltaSet(MetricValue.fromDblValue(0)), create(0, 18).apply(ctx));%0A    %7D%0A%0A    @Test%0A    public void configStringTest() throws Exception %7B%0A        assertEquals(%22percentile_agg(50.0, 0, 1, 2)%22, create(50, 3).configString().toString());%0A    %7D%0A%0A    private static PercentileAggregateExpression create(int p, int count) throws TimeSeriesMetricExpression.ParseException %7B%0A        final String expr = IntStream.concat(IntStream.of(p), IntStream.range(0, count))%0A                .mapToObj(String::valueOf)%0A                .collect(Collectors.joining(%22, %22, %22percentile_agg(%22, %22)%22));%0A        return (PercentileAggregateExpression) TimeSeriesMetricExpression.valueOf(expr);%0A    %7D%0A%7D%0A

Add tests for percentile aggregate function.