void (TargetBackend targetBackend, String ignoreDirective, File testDataFile) { if (AUTOMATICALLY_UNMUTE_PASSED_TESTS) { try { String text = doLoadFile(testDataFile); String directive = ignoreDirective + targetBackend.name(); String newText = Pattern.compile("^" + directive + "\n", Pattern.MULTILINE).matcher(text).replaceAll(""); if (!newText.equals(text)) { System.err.println("\"" + directive + "\" was removed from \"" + testDataFile + "\""); FileUtil.writeToFile(testDataFile, newText); } } catch (IOException e) { throw new RuntimeException(e); } } throw new AssertionError( String.format("Looks like this test can be unmuted. Remove \"%s%s\" directive.", ignoreDirective, targetBackend)); }