package uk.ac.ebi.atlas.profiles.stream;

import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import uk.ac.ebi.atlas.model.AssayGroup;
import uk.ac.ebi.atlas.model.Expression;
import uk.ac.ebi.atlas.model.experiment.baseline.BaselineExperiment;
import uk.ac.ebi.atlas.model.experiment.baseline.BaselineExperimentTest;
import uk.ac.ebi.atlas.model.experiment.baseline.BaselineExpression;
import uk.ac.ebi.atlas.resource.MockDataFileHub;

import static org.junit.Assert.assertThat;

@RunWith(MockitoJUnitRunner.class)
public class ProteomicsBaselineProfileStreamFactoryTest {

    ProteomicsBaselineProfileStreamFactory.Impl subject;

    AssayGroup g1 = new AssayGroup("g1", "r1");
    AssayGroup g2 = new AssayGroup("g2", "r2");


    BaselineExperiment baselineExperiment = BaselineExperimentTest.mockExperiment(ImmutableList.of(
            g1, g2
    ), "accession");

    @Before
    public void setUp() throws Exception {
        subject = new ProteomicsBaselineProfileStreamFactory.Impl(new MockDataFileHub());
    }

    @Test
    public void proteomicsHeadersCanHaveSpectraclCountStuff(){
        //gene name and gene id gets removed somewhere else
        //future proteomics headers will not even have the extra SpectralCount
        CreatesProfilesFromTsvFiles.ProfileFromTsvLine profileFromTsvLine = subject.howToReadLineStream(baselineExperiment, Predicates.<BaselineExpression>alwaysTrue())
                .apply("id name g1.SpectralCount g2.SpectralCount g1.WithInSampleAbundance g2.WithInSampleAbundance".split(" "));

        assertThat(
                profileFromTsvLine.apply(new String[]{"id", "name", "_", "_", "1.0", "2.0"}).getExpression(g1),
                Matchers.<Expression>is(new BaselineExpression(1.0, g1.getId()))
        );
    }




}
@@ -39,50 +39,8 @@
 m;%0A%0A
-import com.google.common.base.Predicates;%0A
 impo
@@ -217,15 +217,13 @@
 ito.
-runners
+junit
 .Moc
@@ -284,49 +284,8 @@
 up;%0A
-import uk.ac.ebi.atlas.model.Expression;%0A
 impo
@@ -878,16 +878,28 @@
 riment =
+%0A           
  Baselin
@@ -950,32 +950,14 @@
 .of(
-%0A            
 g1, g2
-%0A    
 ), %22
@@ -1409,16 +1409,32 @@
 svLine =
+%0A               
  subject
@@ -1478,21 +1478,9 @@
 nt, 
-Predicates.%3CB
+b
 asel
@@ -1496,21 +1496,16 @@
 sion
-%3EalwaysT
+ -%3E t
 rue
-()
 )%0A  
@@ -1525,16 +1525,41 @@
  .apply(
+%0A                        
 %22id name
@@ -1643,16 +1643,49 @@
 undance%22
+%0A                                
 .split(%22
@@ -1852,20 +1852,8 @@
 ers.
-%3CExpression%3E
 is(n
@@ -1891,25 +1891,16 @@
 etId()))
-%0A        
 );%0A    %7D
@@ -1901,12 +1901,9 @@
 %0A    %7D%0A%0A
-%0A%0A%0A
 %7D

Replace Guava’s functional classes with native Java 8 stuff