diff --git a/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/SamplesTsvToJsonTest.scala b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/SamplesTsvToJsonTest.scala new file mode 100644 index 0000000000000000000000000000000000000000..f9b32ca380e3293fc77139c0658f1a74d4f66a0e --- /dev/null +++ b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/SamplesTsvToJsonTest.scala @@ -0,0 +1,51 @@ +package nl.lumc.sasc.biopet.tools + +import java.io.File +import java.nio.file.Paths + +import org.scalatest.Matchers +import org.scalatest.mock.MockitoSugar +import org.scalatest.testng.TestNGSuite +import org.testng.annotations.Test + +/** + * Created by ahbbollen on 28-8-15. + */ +class SamplesTsvToJsonTest extends TestNGSuite with MockitoSugar with Matchers { + import SamplesTsvToJson._ + private def resourcePath(p: String): String = { + Paths.get(getClass.getResource(p).toURI).toString + } + + @Test + def testCorrectSampleTsv = { + val tsv = resourcePath("/sample.tsv") + + noException should be thrownBy main(Array("-i", tsv)) + } + + @Test + def testNoSampleColumn() = { + val tsv = resourcePath("/no_sample.tsv") + val thrown = the [IllegalStateException] thrownBy main(Array("-i", tsv)) + thrown.getMessage should equal ("Sample column does not exist in: " + tsv) + } + + @Test + def testNumberInLibs = { + val tsv = resourcePath("/number.tsv") + val thrown = the [IllegalStateException] thrownBy main(Array("-i", tsv)) + thrown.getMessage should equal ("Sample or library may not start with a number") + } + + @Test + def testSampleIDs = { + val tsv = resourcePath("/same.tsv") + val thrown = the [IllegalStateException] thrownBy main(Array("-i", tsv)) + thrown.getMessage should equal ("Combination of Sample_ID_1 and Lib_ID_1 is found multiple times") + + } + + + +}