summaryrefslogtreecommitdiff
path: root/cli/source/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedSoundexAlgorithmSpec.scala
diff options
context:
space:
mode:
Diffstat (limited to 'cli/source/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedSoundexAlgorithmSpec.scala')
-rwxr-xr-xcli/source/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedSoundexAlgorithmSpec.scala39
1 files changed, 39 insertions, 0 deletions
diff --git a/cli/source/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedSoundexAlgorithmSpec.scala b/cli/source/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedSoundexAlgorithmSpec.scala
new file mode 100755
index 0000000..fc014d0
--- /dev/null
+++ b/cli/source/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedSoundexAlgorithmSpec.scala
@@ -0,0 +1,39 @@
+package com.rockymadden.stringmetric.cli.phonetic
+
+import com.rockymadden.stringmetric.ScalaTest
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class refinedSoundexAlgorithmSpec extends ScalaTest {
+ "refinedSoundexAlgorithm" should provide {
+ "main method" when passed {
+ "valid dashless argument" should executes {
+ "print phonetic representation" in {
+ val out = new java.io.ByteArrayOutputStream()
+
+ Console.withOut(out)(
+ refinedSoundexAlgorithm.main(Array("--unitTest", "--debug", "abc"))
+ )
+
+ out.toString should equal ("a013\n")
+ out.reset()
+
+ Console.withOut(out)(
+ refinedSoundexAlgorithm.main(Array("--unitTest", "--debug", "1"))
+ )
+
+ out.toString should equal ("not computable\n")
+ out.reset()
+ }
+ }
+ "no dashless argument" should throws {
+ "IllegalArgumentException" in {
+ evaluating {
+ refinedSoundexAlgorithm.main(Array("--unitTest", "--debug"))
+ } should produce [IllegalArgumentException]
+ }
+ }
+ }
+ }
+} \ No newline at end of file