### Question:
Source implements javax0.geci.api.Source { private Source(Generator currentGenerator, String className, String relativeFile, String absoluteFile, SegmentSplitHelper splitHelper, List<String> lines ) { this.currentGenerator = currentGenerator; this.className = className; this.relativeFile = relativeFile; this.absoluteFile = absoluteFile; this.splitHelper = splitHelper; this.lines.addAll(lines); this.originals.addAll(lines); this.collector = null; this.inMemory = true; this.store = new MockSourceStore(); } private  Source(Generator currentGenerator,
                   String className,
                   String relativeFile,
                   String absoluteFile,
                   SegmentSplitHelper splitHelper,
                   List<String> lines
    );   Source(FileCollector collector, String dir, Path path); MockSourceStore getSourceStore(); static MockBuilder mock(Generator sut); @Override String getAbsoluteFile(); @Override void init(String id); @Override javax0.geci.api.Source newSource(Source.Set sourceSet, String fileName); @Override javax0.geci.api.Source newSource(String fileName); @Override String toString(); @Override void returns(final List<String> lines); @Override List<String> borrows(); @Override List<String> getLines(); @Override Segment open(); @Override java.util.Set<String> segmentNames(); @Override Segment temporary(); @Override Segment safeOpen(String id); @Override void allowDefaultSegment(); @Override Segment open(String id); @Override String getKlassName(); @Override String getKlassSimpleName(); @Override Class<?> getKlass(); @Override Logger getLogger(); @Override String getPackageName(); void consolidate(); @Override boolean equals(Object other); @Override int hashCode();  }### Answer:
@Test public void testSource() throws IOException { final var collector = new FileCollector(JVM8Tools.asMap()); var sut = new Source(collector, "ddd", Paths.get("xyz.java")); sut.inMemory = true; sut.lines.addAll(Arrays.asList( "This is something there", " "this is to be replaced", "this is also to be replaced", " " "this is unharmed", "this is also unharmed", " )); var seg = sut.open("myId"); seg.write("this is the replacement first line"); seg.write("this is the replacement 2 line"); seg.write("this is the replacement 3 line"); seg.write_r("next is intended"); seg.write("intended line"); seg.write_l("normal line"); sut.consolidate(); assertEquals("This is something there\n" + " " this is the replacement first line\n" + " this is the replacement 2 line\n" + " this is the replacement 3 line\n" + " next is intended\n" + " intended line\n" + " normal line\n" + " " "this is unharmed\n" + "this is also unharmed\n" + " }