summaryrefslogtreecommitdiff
path: root/cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2014-01-06 10:48:10 -0700
committerRocky Madden <git@rockymadden.com>2014-01-06 10:48:10 -0700
commit7b33ad53548c53ce1b8441871fc67fc67f456fdd (patch)
tree6b7efe82cc710b38ba7a4cb3637f84de92966ac4 /cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala
parentab53b6fd3023748a39b27dcc8784c3880e413833 (diff)
downloadstringmetric-7b33ad53548c53ce1b8441871fc67fc67f456fdd.tar.gz
stringmetric-7b33ad53548c53ce1b8441871fc67fc67f456fdd.tar.bz2
stringmetric-7b33ad53548c53ce1b8441871fc67fc67f456fdd.zip
Converted subproject to specs2 from scalatest.
Diffstat (limited to 'cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala')
-rwxr-xr-xcli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala72
1 files changed, 14 insertions, 58 deletions
diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala
index 3106b02..8596613 100755
--- a/cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala
+++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala
@@ -1,66 +1,22 @@
package com.rockymadden.stringmetric.cli.similarity
-import com.rockymadden.stringmetric.cli.ScalaTest
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
+object ngrammetricSpec extends org.specs2.mutable.SpecificationWithJUnit {
+ "ngrammetric main()" should {
+ "print if they are a match with valid dashless arguments and valid n argument" in {
+ val out = new java.io.ByteArrayOutputStream()
-@RunWith(classOf[JUnitRunner])
-final class ngrammetricSpec extends ScalaTest { "ngrammetric" should provide {
- "main method" when passed {
- "valid dashless arguments and valid n argument" should executes {
- "print if they are a match" in {
- val out = new java.io.ByteArrayOutputStream()
+ Console.withOut(out)(ngrammetric.main(Array("--unitTest", "--debug", "--n=1", "abc", "abc")))
+ out.toString must beEqualTo("1.0\n")
+ out.reset()
- Console.withOut(out)(
- ngrammetric.main(
- Array(
- "--unitTest",
- "--debug",
- "--n=1",
- "abc",
- "abc"
- )
- )
- )
-
- out.toString should equal ("1.0\n")
- out.reset()
-
- Console.withOut(out)(
- ngrammetric.main(
- Array(
- "--unitTest",
- "--debug",
- "--n=1",
- "abc",
- "xyz"
- )
- )
- )
-
- out.toString should equal ("0.0\n")
- out.reset()
- }
+ Console.withOut(out)(ngrammetric.main(Array("--unitTest", "--debug", "--n=1", "abc", "xyz")))
+ out.toString must beEqualTo("0.0\n")
}
- "valid dashless arguments and invalid n argument" should throws {
- "IllegalArgumentException" in {
- evaluating {
- ngrammetric.main(
- Array(
- "--unitTest",
- "abc",
- "abc"
- )
- )
- } should produce [IllegalArgumentException]
- }
+ "throw IllegalArgumentException with valid dashless arguments but invalid n argument" in {
+ ngrammetric.main(Array("--unitTest", "abc", "abc")) must throwA[IllegalArgumentException]
}
- "no dashless arguments" should throws {
- "IllegalArgumentException" in {
- evaluating {
- ngrammetric.main(Array("--unitTest", "--debug"))
- } should produce [IllegalArgumentException]
- }
+ "throw IllegalArgumentException with no dashless arguments" in {
+ ngrammetric.main(Array("--unitTest", "--debug")) must throwA[IllegalArgumentException]
}
}
-}}
+}