@Test
	public void testMonthCounts() throws Exception {
		final DateTime start = new DateTime(2013, 11, 20, 0, 0);
		final DateTime end   = start.plusMonths(5);
		int val = 1;

		for (DateTime now = start; !now.isAfter(end); now = now.plusMonths(1)) {
			aggregateCounterRepository.increment(counterName, val++, now);
		}
		long[] counts = aggregateCounterRepository.getCounts(counterName, new Interval(start,end), AggregateCountResolution.month).getCounts();
		assertEquals(6, counts.length);

		for (int i = 0; i < counts.length; i++) {
			assertEquals("count at index " + i + " should be " + (i + 1), i + 1, counts[i]);
		}

		// Check a query for twelve months past
		counts = aggregateCounterRepository.getCounts(counterName, new Interval(end.minusMonths(11), end), AggregateCountResolution.month).getCounts();
		assertEquals(12, counts.length);

		counts = aggregateCounterRepository.getCounts(counterName, 3, end, AggregateCountResolution.month).getCounts();
		assertEquals(3, counts.length);
		assertEquals(6, counts[2]);
	}
@author Luke Taylor
@author Gary Russell
@author Ilayaperumal Gopinathan
spring-xd-analytics/src/test/java/org/springframework/xd/analytics/metrics/AbstractAggregateCounterTests.java