diff --git a/bam2wig/pom.xml b/bam2wig/pom.xml index 5afb29d42f96f6bda92b4d8c6a35d2b09308f558..82fc7fff5fd91f4c46fd22421fdb54c89ccf3871 100644 --- a/bam2wig/pom.xml +++ b/bam2wig/pom.xml @@ -45,6 +45,18 @@ <artifactId>BiopetExtensions</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.scalatest</groupId> + <artifactId>scalatest_2.10</artifactId> + <version>2.2.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>6.8</version> + <scope>test</scope> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/bam2wig/src/test/resources/empty.bam b/bam2wig/src/test/resources/empty.bam new file mode 100644 index 0000000000000000000000000000000000000000..bd4073d80cbf73c689e97d2814f9b1fd00d63895 Binary files /dev/null and b/bam2wig/src/test/resources/empty.bam differ diff --git a/bam2wig/src/test/scala/nl/lumc/sasc/biopet/pipelines/bamtobigwig/BamToChromSizesTest.scala b/bam2wig/src/test/scala/nl/lumc/sasc/biopet/pipelines/bamtobigwig/BamToChromSizesTest.scala new file mode 100644 index 0000000000000000000000000000000000000000..6d2c9798aa55250a6654ad44ea6098e5532791f5 --- /dev/null +++ b/bam2wig/src/test/scala/nl/lumc/sasc/biopet/pipelines/bamtobigwig/BamToChromSizesTest.scala @@ -0,0 +1,31 @@ +package nl.lumc.sasc.biopet.pipelines.bamtobigwig + +import java.io.File +import java.nio.file.Paths + +import org.scalatest.Matchers +import org.scalatest.testng.TestNGSuite +import org.testng.annotations.Test + +import scala.io.Source + + +/** + * Created by pjvanthof on 09/05/16. + */ +class BamToChromSizesTest extends TestNGSuite with Matchers { + private def resourcePath(p: String): String = { + Paths.get(getClass.getResource(p).toURI).toString + } + + @Test + def testChromSizes: Unit = { + val bamFile = new File(resourcePath("/empty.bam")) + val bamToChromSizes = new BamToChromSizes(null) + bamToChromSizes.bamFile = bamFile + bamToChromSizes.chromSizesFile = File.createTempFile("chrom.", ".sizes") + bamToChromSizes.chromSizesFile.deleteOnExit() + bamToChromSizes.run() + Source.fromFile(bamToChromSizes.chromSizesFile).getLines().toList shouldBe List("chrQ\t10000", "chrR\t10000") + } +}