ConfigValueTest.scala 1.75 KB
Newer Older
bow's avatar
bow committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * Biopet is built on top of GATK Queue for building bioinformatic
 * pipelines. It is mainly intended to support LUMC SHARK cluster which is running
 * SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
 * should also be able to execute Biopet tools and pipelines.
 *
 * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
 *
 * Contact us at: sasc@lumc.nl
 *
 * A dual licensing mode is applied. The source code within this project that are
 * not part of GATK Queue is freely available for non-commercial use under an AGPL
 * license; For commercial users or users who do not want to follow the AGPL
 * license, please contact us to obtain a separate license.
 */
Peter van 't Hof's avatar
Peter van 't Hof committed
16
package nl.lumc.sasc.biopet.utils.config
17
18
19
20
21
22
23
24

import java.io.File

import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test

/**
Peter van 't Hof's avatar
Peter van 't Hof committed
25
26
 * Test class for [[ConfigValue]]
 *
27
28
 * Created by pjvan_thof on 1/8/15.
 */
Peter van 't Hof's avatar
Peter van 't Hof committed
29
class ConfigValueTest extends TestNGSuite with Matchers {
30
  val index = ConfigValueIndex("", Nil, "")
Peter van 't Hof's avatar
Peter van 't Hof committed
31
  @Test def testAs(): Unit = {
32
33
34
35
36
37
38
39
40
41
    ConfigValue(index, index, "bla").asString shouldBe "bla"
    ConfigValue(index, index, 1).asInt shouldBe 1
    ConfigValue(index, index, 1.0).asDouble shouldBe 1.0
    ConfigValue(index, index, List("bla")).asList shouldBe List("bla")
    ConfigValue(index, index, true).asBoolean shouldBe true
    ConfigValue(index, index, Map("1" -> 1)).asMap shouldBe Map("1" -> 1)
    ConfigValue(index, index, List("bla")).asStringList shouldBe List("bla")
    ConfigValue(index, index, List("bla")).asFileList shouldBe List(new File("bla"))
  }

Peter van 't Hof's avatar
Peter van 't Hof committed
42
43
  @Test def testToString(): Unit = {
    ConfigValue(index, index, "bla", default = true).toString.getClass.getSimpleName shouldBe "String"
44
45
  }
}