@Test
	public void testSingleCountInStream() {
		String counterName = "cn" + UUID.randomUUID().toString();
		String labelName = "ln" + UUID.randomUUID().toString();

		stream(streamName, sources.http() + XD_DELIMITER + labelName +
				": filter --expression=#jsonPath(payload,'$.entities.hashtags[*]." +
				"text').contains('good')" + XD_DELIMITER +
				sinks.file());

		stream(sources.tap(streamName).label(labelName) + XD_TAP_DELIMITER +
				sinks.counterSink(counterName));

		sources.httpSource(streamName).postData(GOOD_TEXT);
		waitForMetric(counterName);

		assertEquals("The value expected for this counter was 1", 1, getCount(counterName));
	}
Verifies that a single count can be captured from a stream.
spring-xd-integration-test/src/test/java/org/springframework/xd/integration/test/CountTests.java