void (@NotNull String filePath, @NotNull String actualText, boolean trimBeforeComparing, @Nullable Supplier<String> messageProducer) { String fileText; try { if (OVERWRITE_TESTDATA) { VfsTestUtil.overwriteTestData(filePath, actualText); //noinspection UseOfSystemOutOrSystemErr System.out.println("File " + filePath + " created."); } fileText = FileUtil.loadFile(new File(filePath), StandardCharsets.UTF_8); } catch (FileNotFoundException e) { VfsTestUtil.overwriteTestData(filePath, actualText); throw new AssertionFailedError("No output text found. File " + filePath + " created."); } catch (IOException e) { throw new RuntimeException(e); } String expected = StringUtil.convertLineSeparators(trimBeforeComparing ? fileText.trim() : fileText); String actual = StringUtil.convertLineSeparators(trimBeforeComparing ? actualText.trim() : actualText); if (!Objects.equals(expected, actual)) { throw new FileComparisonFailure(messageProducer == null ? null : messageProducer.get(), expected, actual, filePath); } }