diff options
author | Rocky Madden <git@rockymadden.com> | 2014-01-06 10:48:10 -0700 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2014-01-06 10:48:10 -0700 |
commit | 7b33ad53548c53ce1b8441871fc67fc67f456fdd (patch) | |
tree | 6b7efe82cc710b38ba7a4cb3637f84de92966ac4 /cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala | |
parent | ab53b6fd3023748a39b27dcc8784c3880e413833 (diff) | |
download | stringmetric-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-x | cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/ngrammetricSpec.scala | 72 |
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] } } -}} +} |