### Question:
NexusWriter extends AbstractSpectreWriter implements Appendable { @Override public void writeSplitSystem(File file, SplitSystem ss) throws IOException { this.fileContent = new StringBuilder(); this.appendHeader() .appendLine() .append(ss.getOrderedTaxa().sortById()) .appendLine() .append(ss); this.write(file); } NexusWriter(); @Override void writeSplitSystem(File file, SplitSystem ss); @Override void writeDistanceMatrix(File file, DistanceMatrix distanceMatrix); void writeNexusData(File file, Nexus nexusData); void write(File file); NexusWriter appendHeader(); NexusWriter append(IdentifierList taxa); NexusWriter append(Sequences a); NexusWriter append(DistanceMatrix dm); NexusWriter append(DistanceMatrix dm, DistanceMatrixBuilder.Triangle triangle); NexusWriter append(QuadrupleSystem qs); NexusWriter append(SplitSystem ss); NexusWriter append(Vertex net, int nTaxa, IdentifierList taxa); NexusWriter append(Network network); NexusWriter append(ViewerConfig config); @Override NexusWriter append(CharSequence csq); @Override NexusWriter append(CharSequence csq, int start, int end); @Override NexusWriter append(char c); NexusWriter append(String s); NexusWriter appendLine(String s); NexusWriter appendLine();  }### Answer:
@Test public void testWriteNetwork() throws IOException { File outputDir = temp.newFolder("networkTest"); File outputFile = new File(outputDir, "network.nex"); final int size = 5; SplitSystem ss = new SpectreSplitSystem(new FlexibleDistanceMatrix(size)); new NexusWriter().writeSplitSystem(outputFile, ss); assertTrue(outputFile.exists()); List<String> lines = FileUtils.readLines(outputFile, "UTF-8"); assertTrue(lines.size() == 20 || lines.size() == 21); }