diff options
Diffstat (limited to 'cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonealgorithmSpec.scala')
-rwxr-xr-x | cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonealgorithmSpec.scala | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonealgorithmSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonealgorithmSpec.scala index 8b8226d..1b22943 100755 --- a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonealgorithmSpec.scala +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonealgorithmSpec.scala @@ -1,37 +1,19 @@ package com.rockymadden.stringmetric.cli.phonetic -import com.rockymadden.stringmetric.cli.ScalaTest -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner +object metaphonealgorithmSpec extends org.specs2.mutable.SpecificationWithJUnit { + "metaphonealgorithm main()" should { + "print phonetic representation with valid dashless argument" in { + val out = new java.io.ByteArrayOutputStream() -@RunWith(classOf[JUnitRunner]) -final class metaphonealgorithmSpec extends ScalaTest { "metaphonealgorithm" should provide { - "main method" when passed { - "valid dashless argument" should executes { - "print phonetic representation" in { - val out = new java.io.ByteArrayOutputStream() + Console.withOut(out)(metaphonealgorithm.main(Array("--unitTest", "--debug", "abc"))) + out.toString must beEqualTo("abk\n") + out.reset() - Console.withOut(out)( - metaphonealgorithm.main(Array("--unitTest", "--debug", "abc")) - ) - - out.toString should equal ("abk\n") - out.reset() - - Console.withOut(out)( - metaphonealgorithm.main(Array("--unitTest", "--debug", "1")) - ) - - out.toString should equal ("not computable\n") - out.reset() - } + Console.withOut(out)(metaphonealgorithm.main(Array("--unitTest", "--debug", "1"))) + out.toString must beEqualTo("not computable\n") } - "no dashless argument" should throws { - "IllegalArgumentException" in { - evaluating { - metaphonealgorithm.main(Array("--unitTest", "--debug")) - } should produce [IllegalArgumentException] - } + "throw IllegalArgumentException with no dashless argument" in { + metaphonealgorithm.main(Array("--unitTest", "--debug")) must throwA[IllegalArgumentException] } } -}} +} |