Commit 1a85e5ca authored by Peter van 't Hof's avatar Peter van 't Hof

Added unit tests

parent 01d2c652
......@@ -22,13 +22,12 @@ import nl.lumc.sasc.biopet.utils.config.{ Config, Configurable }
import org.scalatest.Matchers
import org.scalatest.mock.MockitoSugar
import org.scalatest.testng.TestNGSuite
import org.mockito.Mockito._
import org.testng.annotations.Test
/**
* Created by pjvan_thof on 12/30/15.
*/
class ReferenceTest extends TestNGSuite with Matchers with MockitoSugar {
class ReferenceTest extends TestNGSuite with Matchers {
import ReferenceTest._
......
package nl.lumc.sasc.biopet.core.annotation
import java.io.File
import nl.lumc.sasc.biopet.core.BiopetQScript
import nl.lumc.sasc.biopet.core.annotations.{ AnnotationGff, AnnotationGtf, AnnotationRefFlat }
import nl.lumc.sasc.biopet.utils.Logging
import nl.lumc.sasc.biopet.utils.config.Config
import org.broadinstitute.gatk.queue.QScript
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test
/**
* Created by pjvanthof on 18/11/2016.
*/
class AnnotationTest extends TestNGSuite with Matchers {
@Test
def testAnnotationGtf: Unit = {
val s1 = new AnnotationTest.Script(AnnotationTest.config) with AnnotationGtf
s1.annotationGtf shouldBe new File("")
an[IllegalStateException] shouldBe thrownBy(Logging.checkErrors())
val s2 = new AnnotationTest.Script(AnnotationTest.config ++ Map("species" -> "s1", "reference_name" -> "g1")) with AnnotationGtf
s2.annotationGtf shouldBe new File("no_set.gtf")
noException should be thrownBy (Logging.checkErrors())
val s3 = new AnnotationTest.Script(AnnotationTest.config ++ Map("species" -> "s1", "reference_name" -> "g1", "gene_annotation_name" -> "set1")) with AnnotationGtf
s3.annotationGtf shouldBe new File("set1.gtf")
noException should be thrownBy (Logging.checkErrors())
}
@Test
def testAnnotationGff: Unit = {
val s1 = new AnnotationTest.Script(AnnotationTest.config) with AnnotationGff
s1.annotationGff shouldBe new File("")
an[IllegalStateException] shouldBe thrownBy(Logging.checkErrors())
val s2 = new AnnotationTest.Script(AnnotationTest.config ++ Map("species" -> "s1", "reference_name" -> "g1")) with AnnotationGff
s2.annotationGff shouldBe new File("no_set.gff")
noException should be thrownBy (Logging.checkErrors())
val s3 = new AnnotationTest.Script(AnnotationTest.config ++ Map("species" -> "s1", "reference_name" -> "g1", "gene_annotation_name" -> "set1")) with AnnotationGff
s3.annotationGff shouldBe new File("set1.gff")
noException should be thrownBy (Logging.checkErrors())
}
@Test
def testAnnotationRefFlat: Unit = {
val s1 = new AnnotationTest.Script(AnnotationTest.config) with AnnotationRefFlat
s1.annotationRefFlat.get shouldBe new File("")
an[IllegalStateException] shouldBe thrownBy(Logging.checkErrors())
val s2 = new AnnotationTest.Script(AnnotationTest.config ++ Map("species" -> "s1", "reference_name" -> "g1")) with AnnotationRefFlat
s2.annotationRefFlat.get shouldBe new File("no_set.refFlat")
noException should be thrownBy (Logging.checkErrors())
val s3 = new AnnotationTest.Script(AnnotationTest.config ++ Map("species" -> "s1", "reference_name" -> "g1", "gene_annotation_name" -> "set1")) with AnnotationRefFlat
s3.annotationRefFlat.get shouldBe new File("set1.refFlat")
noException should be thrownBy (Logging.checkErrors())
}
}
object AnnotationTest {
class Script(c: Map[String, Any]) extends QScript with BiopetQScript {
override def globalConfig: Config = new Config(c)
val root = null
/** Init for pipeline */
def init(): Unit = ???
/** Pipeline itself */
def biopetScript(): Unit = ???
}
val config: Map[String, Any] = Map("references" -> Map("s1" -> Map("g1" -> Map(
"annotation_gtf" -> "no_set.gtf",
"annotation_gff" -> "no_set.gff",
"annotation_refflat" -> "no_set.refFlat",
"gene_annotations" -> Map("set1" -> Map(
"annotation_gtf" -> "set1.gtf",
"annotation_gff" -> "set1.gff",
"annotation_refflat" -> "set1.refFlat"
))
))))
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment