public static String assertCorrectOutput(RuntimeTestDescriptor descriptor, String targetName, State state) {
		ExecutedState executedState;
		if (state instanceof ExecutedState) {
			executedState = (ExecutedState)state;
			if (executedState.exception != null) {
				return state.getErrorMessage();
			}
		}
		else {
			return state.getErrorMessage();
		}

		String expectedOutput = descriptor.output;
		String expectedParseErrors = descriptor.errors;

		boolean doesOutputEqualToExpected = executedState.output.equals(expectedOutput);
		if (!doesOutputEqualToExpected || !executedState.errors.equals(expectedParseErrors)) {
			String message;
			if (doesOutputEqualToExpected) {
				message = "Parse output is as expected, but errors are not: ";
			}
			else {
				message = "Parse output is incorrect: " +
						"expectedOutput:<" + expectedOutput + ">; actualOutput:<" + executedState.output + ">; ";
			}

			return "[" + targetName + ":" + descriptor.name + "] " +
					message +
					"expectedParseErrors:<" + expectedParseErrors + ">;" +
					"actualParseErrors:<" + executedState.errors + ">.";
		}

		return null;
	}
This class represents runtime tests for specified runtime.
 It pulls data from {@link RuntimeTestDescriptor} and uses junit to trigger tests.
 The only functionality needed to execute a test is defined in {@link RuntimeRunner}.
 All the various test rig classes derived from this one.
 E.g., see {@link JavaRuntimeTests}.
runtime-testsuite/test/org/antlr/v4/test/runtime/RuntimeTests.java