private static String prepareGrammars(RuntimeTestDescriptor descriptor, RuntimeRunner runner) {
		String targetName = runner.getLanguage();

		STGroup targetTemplates;
		synchronized (cachedTargetTemplates) {
			targetTemplates = cachedTargetTemplates.get(targetName);
			if (targetTemplates == null) {
				ClassLoader classLoader = RuntimeTests.class.getClassLoader();
				URL templates = classLoader.getResource("org/antlr/v4/test/runtime/templates/" + targetName + ".test.stg");
				assert templates != null;
				targetTemplates = new STGroupFile(templates, "UTF-8", '<', '>');
				targetTemplates.registerRenderer(String.class, rendered);
				cachedTargetTemplates.put(targetName, targetTemplates);
			}
		}

		// write out any slave grammars
		List<Pair<String, String>> slaveGrammars = descriptor.slaveGrammars;
		if (slaveGrammars != null) {
			for (Pair<String, String> spair : slaveGrammars) {
				STGroup g = new STGroup('<', '>');
				g.registerRenderer(String.class, rendered);
				g.importTemplates(targetTemplates);
				ST grammarST = new ST(g, spair.b);
				writeFile(runner.getTempDirPath(), spair.a + ".g4", grammarST.render());
			}
		}

		STGroup g = new STGroup('<', '>');
		g.importTemplates(targetTemplates);
		g.registerRenderer(String.class, rendered);
		ST grammarST = new ST(g, descriptor.grammar);
		return grammarST.render();
	}
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