package uk.ac.ebi.pride.utilities.data.io.file;

import com.jamonapi.Monitor;
import com.jamonapi.MonitorFactory;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.net.URL;

/**
 * @author Suresh Hewapathirana
 */
public class FastMzIdentMLUnmarshallerAdaptorTest {

    FastMzIdentMLUnmarshallerAdaptor fastValidateMzIdentMLUnmarshaller;

    @Before
    public void setUp() throws Exception {
      URL url = FastMzIdentMLUnmarshallerAdaptorTest.class.getClassLoader().getResource("small.mzid");
      URL urlMgf = FastMzIdentMLUnmarshallerAdaptorTest.class.getClassLoader().getResource("small.mgf");

      if (url == null || urlMgf == null) {
        throw new IllegalStateException("no file for input found!");
      }
      File inputFile = new File(url.toURI());
      this.fastValidateMzIdentMLUnmarshaller = new FastMzIdentMLUnmarshallerAdaptor(inputFile);
    }

//    @Test
//    public void doUnmarshell() {
//            Monitor monitor= MonitorFactory.start("uk.ac.ebi.pride.utilities.data.io.file.doUnmarshell");
//            this.fastValidateMzIdentMLUnmarshaller = new FastMzIdentMLUnmarshallerAdaptor(new File("<File full path here>"));
//            monitor.stop();
//            System.out.println("Performance INFO: --------------  " + monitor);
//    }

  @Test
  public void isSpectraDataReferencedByTitle() {
    Assert.assertFalse("Spectra of this MzIdentML is not referred by title", fastValidateMzIdentMLUnmarshaller.isSpectraDataReferencedByTitle(fastValidateMzIdentMLUnmarshaller.getSpectraData().get(0)));
  }

  @Test
  public void getVersion() {
    Assert.assertEquals("MzIdentML Version should be 1.1.0","1.1.0", fastValidateMzIdentMLUnmarshaller.getVersion());
  }


  @Test
  public void getCvList() {
    Assert.assertEquals("small.mzid file first CV in the CvList should be PSI-MS","PSI-MS", fastValidateMzIdentMLUnmarshaller.getCvList().get(0).getId());
  }

  @After
  public void tearDown() throws Exception {
    fastValidateMzIdentMLUnmarshaller.close();
  }
}
@@ -53,242 +53,272 @@
 ort 
-com.jamonapi.Monitor;%0Aimport com.jamonapi.MonitorFactory;%0Aimport org.junit.After;%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.io.File;%0Aimport java.net.URL;%0A%0A/**%0A * @author Suresh Hewapathirana
+org.junit.*;%0A%0Aimport java.io.File;%0Aimport java.net.URL;%0A%0A/**%0A * @author Suresh Hewapathirana%0A */%0A%0A/**%0A * This class only do few testing to verify that mzIdentML unmarshalling works fine.%0A * Rest of the other methods are tested by FastMzIdentMLControllerTest class.
 %0A */
@@ -981,709 +981,128 @@
  %7D%0A%0A
-//
+  /**%0A
    
+*
  
-@
 Test
-%0A//    public void doUnmarshell() %7B%0A//            Monitor monitor= MonitorFactory.start(%22uk.ac.ebi.pride.utilities.data.io.file.doUnmarshell%22);%0A//            this.fastValidateMzIdentMLUnmarshaller = new FastMzIdentMLUnmarshallerAdaptor(new File(%22%3CFile full path here%3E%22));%0A//            monitor.stop();%0A//            System.out.println(%22Performance INFO: --------------  %22 + monitor);%0A//    %7D%0A%0A  @Test%0A  public void isSpectraDataReferencedByTitle() %7B%0A    Assert.assertFalse(%22Spectra of this MzIdentML is not referred by title%22, fastValidateMzIdentMLUnmarshaller.isSpectraDataReferencedByTitle(fastValidateMzIdentMLUnmarshaller.getSpectraData().get(0)));%0A  %7D%0A%0A  @Test%0A  public void getVersion
+ few functions to see unmarshalling works fine%0A   */%0A  @Test%0A  public void testFastMzIdentMLUnmarshalling
 () %7B
@@ -1224,50 +1224,8 @@
 ));%0A
-  %7D%0A%0A%0A  @Test%0A  public void getCvList() %7B%0A
     
@@ -1375,16 +1375,219 @@
 tId());%0A
+    Assert.assertFalse(%22Spectra of this MzIdentML is not referred by title%22, fastValidateMzIdentMLUnmarshaller.isSpectraDataReferencedByTitle(fastValidateMzIdentMLUnmarshaller.getSpectraData().get(0)));%0A
   %7D%0A%0A  @

change Test case