MspExportAlgorithm { public static void exportSpectrum(@Nonnull File exportFile, @Nonnull MsSpectrum spectrum) throws IOException, MSDKException { exportSpectra(exportFile, Collections.singleton(spectrum)); }  static void exportSpectrum(@Nonnull File exportFile, @Nonnull MsSpectrum spectrum); static void exportSpectra(@Nonnull File exportFile,
      @Nonnull Collection<MsSpectrum> spectra);  }
@Test public void testExportMSP() throws MSDKException, IOException { File tmpFile = File.createTempFile("msdktest", "msp"); tmpFile.deleteOnExit(); MsSpectrum testSpectrum = new SimpleMsSpectrum(new double[] {10.0, 20.0, 30.0}, new float[] {100f, 200f, 300f}, 3, MsSpectrumType.CENTROIDED); MspExportAlgorithm.exportSpectrum(tmpFile, testSpectrum); MspSpectrum importedSpectrum = MspImportAlgorithm.parseMspFromFile(tmpFile); tmpFile.delete(); Assert.assertEquals(testSpectrum.getNumberOfDataPoints(), importedSpectrum.getNumberOfDataPoints()); String testSpectrumAsString = MsSpectrumUtil.msSpectrumToString(testSpectrum); String importedSpectrumAsString = MsSpectrumUtil.msSpectrumToString(importedSpectrum); Assert.assertEquals(testSpectrumAsString, importedSpectrumAsString); Range<Double> all = Range.all(); Float testSpectrumTIC = MsSpectrumUtil.getTIC(testSpectrum.getMzValues(), testSpectrum.getIntensityValues(), testSpectrum.getNumberOfDataPoints(), all); Float importedSpectrumTIC = MsSpectrumUtil.getTIC(importedSpectrum.getMzValues(), importedSpectrum.getIntensityValues(), importedSpectrum.getNumberOfDataPoints(), all); Assert.assertEquals(testSpectrumTIC, importedSpectrumTIC); }