PackageTest.scala 1.43 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof 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.
 */
16
17
18
19
20
21
22
23
24
package nl.lumc.sasc.biopet.utils

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

import scala.util.Try

/**
Peter van 't Hof's avatar
Peter van 't Hof committed
25
26
 * Test class for utils package object
 *
27
28
29
30
 * Created by pjvan_thof on 4/14/15.
 */
class PackageTest extends TestNGSuite with Matchers {

Peter van 't Hof's avatar
Peter van 't Hof committed
31
  @Test def testConvert(): Unit = {
32
33
34
35
    tryToParseNumber("4") shouldBe Try(4)
    tryToParseNumber("13.37") shouldBe Try(13.37)
    tryToParseNumber("I'm not a number") should not be Try("I'm not a number")

Peter van 't Hof's avatar
Peter van 't Hof committed
36
37
38
    tryToParseNumber("4", fallBack = true) shouldBe Try(4)
    tryToParseNumber("13.37", fallBack = true) shouldBe Try(13.37)
    tryToParseNumber("I'm not a number", fallBack = true) shouldBe Try("I'm not a number")
39
40
  }
}