public static void write(UnifiedDiff diff, Function<String, List<String>> originalLinesProvider, Writer writer, int contextSize) throws IOException {
        Objects.requireNonNull(originalLinesProvider, "original lines provider needs to be specified");
        write(diff, originalLinesProvider, line -> {
            try {
                writer.append(line).append("\n");
            } catch (IOException ex) {
                LOG.log(Level.SEVERE, null, ex);
            }
        }, contextSize);
    }
@Test
    public void testWriteWithNewFile() throws URISyntaxException, IOException {
        
        List<String> original = new ArrayList<>();
        List<String> revised = new ArrayList<>();

        revised.add("line1");
        revised.add("line2");

        Patch<String> patch = DiffUtils.diff(original, revised);
        UnifiedDiff diff = new UnifiedDiff();
        diff.addFile( UnifiedDiffFile.from(null, "revised", patch) );

        StringWriter writer = new StringWriter();
        UnifiedDiffWriter.write(diff, f -> original, writer, 5);
        System.out.println(writer.toString());
        
        String[] lines = writer.toString().split("\\n");
        
        assertEquals("--- /dev/null", lines[0]);
        assertEquals("+++ revised", lines[1]);
        assertEquals("@@ -0,0 +1,2 @@", lines[2]);
    }