TxtExportAlgorithm { public static void exportSpectrum(@Nonnull File exportFile, @Nonnull MsSpectrum spectrum) throws IOException { exportSpectra(exportFile, Collections.singleton(spectrum)); }  static void exportSpectrum(@Nonnull File exportFile, @Nonnull MsSpectrum spectrum); static void exportSpectra(@Nonnull File exportFile,
      @Nonnull Collection<MsSpectrum> spectra); static void exportSpectra(@Nonnull File exportFile,
      @Nonnull Collection<MsSpectrum> spectra, @Nonnull String delimiter); static void spectrumToWriter(@Nonnull MsSpectrum spectrum, @Nonnull Writer writer); static void spectrumToWriter(@Nonnull MsSpectrum spectrum, @Nonnull Writer writer,
      @Nonnull String delimiter); static @Nonnull String spectrumToString(@Nonnull MsSpectrum spectrum); static @Nonnull String spectrumToString(@Nonnull MsSpectrum spectrum,
      @Nonnull String delimiter);  }
@Test public void testExportSpectrum() throws IOException { File file = folder.newFile(); MsSpectrum spectrum = mockSpectrum(mzValues1, intensityValues1); TxtExportAlgorithm.exportSpectrum(file, spectrum); List<String> lines = Files.readAllLines(file.toPath(), Charset.defaultCharset()); String empty = lines.remove(lines.size() - 1); assertThat(empty, isEmptyString()); assertThat(lines.toArray(new String[lines.size()]), arrayContaining(expectedSimple)); }