Commit 57478950 authored by bow's avatar bow
Browse files

Use TestNGSuite and Matchers in WipeReads test

parent 0ea14304
...@@ -9,13 +9,12 @@ import java.io.{ File, IOException } ...@@ -9,13 +9,12 @@ import java.io.{ File, IOException }
import scala.collection.JavaConverters._ import scala.collection.JavaConverters._
import htsjdk.samtools._ import htsjdk.samtools._
import org.scalatest.Assertions import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test import org.testng.annotations.Test
/* TODO: helper function to create SAMRecord from SAM alignment string
so we can test as if using real SAMRecords class WipeReadsUnitTest extends TestNGSuite with Matchers {
*/
class WipeReadsUnitTest extends Assertions {
import WipeReads._ import WipeReads._
...@@ -103,13 +102,13 @@ class WipeReadsUnitTest extends Assertions { ...@@ -103,13 +102,13 @@ class WipeReadsUnitTest extends Assertions {
@Test def testMakeRawIntervalFromBED() = { @Test def testMakeRawIntervalFromBED() = {
val intervals: Vector[RawInterval] = makeRawIntervalFromFile(BEDFile1).toVector val intervals: Vector[RawInterval] = makeRawIntervalFromFile(BEDFile1).toVector
assert(intervals.length == 3) intervals.length should be (3)
assert(intervals.last.chrom == "chrQ") intervals.head.chrom should === ("chrQ")
assert(intervals.last.start == 291) intervals.head.start should be (991)
assert(intervals.last.end == 320) intervals.head.end should be (1000)
assert(intervals.head.chrom == "chrQ") intervals.last.chrom should === ("chrQ")
assert(intervals.head.start == 991) intervals.last.start should be (291)
assert(intervals.head.end == 1000) intervals.last.end should be (320)
} }
@Test def testSingleBAMDefault() = { @Test def testSingleBAMDefault() = {
...@@ -368,9 +367,9 @@ class WipeReadsUnitTest extends Assertions { ...@@ -368,9 +367,9 @@ class WipeReadsUnitTest extends Assertions {
val exp = new SAMFileReader(sBAMFile3).asScala val exp = new SAMFileReader(sBAMFile3).asScala
val obs = new SAMFileReader(outBAM).asScala val obs = new SAMFileReader(outBAM).asScala
for ((e, o) <- exp.zip(obs)) for ((e, o) <- exp.zip(obs))
assert(e.getSAMString === o.getSAMString) e.getSAMString should === (o.getSAMString)
assert(outBAM.exists) outBAM should be ('exists)
assert(outBAMIndex.exists) outBAMIndex should be ('exists)
} }
@Test def testWriteSingleBAMAndFilteredBAM() = { @Test def testWriteSingleBAMAndFilteredBAM() = {
...@@ -387,11 +386,11 @@ class WipeReadsUnitTest extends Assertions { ...@@ -387,11 +386,11 @@ class WipeReadsUnitTest extends Assertions {
val exp = new SAMFileReader(sBAMFile4).asScala val exp = new SAMFileReader(sBAMFile4).asScala
val obs = new SAMFileReader(filteredOutBAM).asScala val obs = new SAMFileReader(filteredOutBAM).asScala
for ((e, o) <- exp.zip(obs)) for ((e, o) <- exp.zip(obs))
assert(e.getSAMString === o.getSAMString) e.getSAMString should === (o.getSAMString)
assert(outBAM.exists) outBAM should be ('exists)
assert(outBAMIndex.exists) outBAMIndex should be ('exists)
assert(filteredOutBAM.exists) filteredOutBAM should be ('exists)
assert(filteredOutBAMIndex.exists) filteredOutBAMIndex should be ('exists)
} }
@Test def testWritePairBAMDefault() = { @Test def testWritePairBAMDefault() = {
...@@ -404,8 +403,8 @@ class WipeReadsUnitTest extends Assertions { ...@@ -404,8 +403,8 @@ class WipeReadsUnitTest extends Assertions {
val exp = new SAMFileReader(pBAMFile3).asScala val exp = new SAMFileReader(pBAMFile3).asScala
val obs = new SAMFileReader(outBAM).asScala val obs = new SAMFileReader(outBAM).asScala
for ((e, o) <- exp.zip(obs)) for ((e, o) <- exp.zip(obs))
assert(e.getSAMString === o.getSAMString) e.getSAMString should === (o.getSAMString)
assert(outBAM.exists) outBAM should be ('exists)
assert(outBAMIndex.exists) outBAMIndex should be ('exists)
} }
} }
\ No newline at end of file
Supports Markdown
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