@Test
public void testEcho() throws Exception {

	// Logging
	List<Map.Entry<Boolean, String>> logRecords =
		new CopyOnWriteArrayList<>();
	Future<Map.Entry<Void, Void>> loggingFuture = ProcessUtil.execute(
		new LoggingOutputProcessor(
			(stdErr, line) -> logRecords.add(
				new AbstractMap.SimpleImmutableEntry<>(stdErr, line))),
		_buildArguments(Echo.class, "2"));
	loggingFuture.get();
	loggingFuture.cancel(true);
	List<String> messageRecords = new ArrayList<>();
	for (Map.Entry<Boolean, String> logRecord : logRecords) {
		messageRecords.add(logRecord.getValue());
	}
	Assert.assertTrue(
		messageRecords.toString(),
		messageRecords.contains(Echo.buildMessage(false, 0)));
	Assert.assertTrue(
		messageRecords.toString(),
		messageRecords.contains(Echo.buildMessage(false, 1)));
	Assert.assertTrue(
		messageRecords.toString(),
		messageRecords.contains(Echo.buildMessage(true, 0)));
	Assert.assertTrue(
		messageRecords.toString(),
		messageRecords.contains(Echo.buildMessage(true, 1)));
	// Collector
	Future<Map.Entry<byte[], byte[]>> collectorFuture = ProcessUtil.execute(
		CollectorOutputProcessor.INSTANCE,
		_buildArguments(Echo.class, "2"));
	Map.Entry<byte[], byte[]> objectValuePair = collectorFuture.get();
	collectorFuture.cancel(true);
	Assert.assertEquals(
		StringBundler.concat(
			Echo.buildMessage(true, 0), "\n", Echo.buildMessage(true, 1),
			"\n"),
		new String(objectValuePair.getKey()));
	Assert.assertEquals(
		StringBundler.concat(
			Echo.buildMessage(false, 0), "\n", Echo.buildMessage(false, 1),
			"\n"),
		new String(objectValuePair.getValue()));
}