summaryrefslogtreecommitdiff
path: root/core/src/test/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricSpec.scala
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricSpec.scala')
-rwxr-xr-xcore/src/test/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricSpec.scala35
1 files changed, 35 insertions, 0 deletions
diff --git a/core/src/test/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricSpec.scala b/core/src/test/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricSpec.scala
new file mode 100755
index 0000000..b903add
--- /dev/null
+++ b/core/src/test/scala/com/rockymadden/stringmetric/phonetic/SoundexMetricSpec.scala
@@ -0,0 +1,35 @@
+package com.rockymadden.stringmetric.phonetic
+
+import com.rockymadden.stringmetric.ScalaTest
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class SoundexMetricSpec extends ScalaTest { "SoundexMetric" should provide {
+ "compare method" when passed {
+ "empty arguments" should returns {
+ "None" in {
+ SoundexMetric.compare("", "").isDefined should be (false)
+ SoundexMetric.compare("abc", "").isDefined should be (false)
+ SoundexMetric.compare("", "xyz").isDefined should be (false)
+ }
+ }
+ "non-phonetic arguments" should returns {
+ "None" in {
+ SoundexMetric.compare("123", "123").isDefined should be (false)
+ SoundexMetric.compare("123", "").isDefined should be (false)
+ SoundexMetric.compare("", "123").isDefined should be (false)
+ }
+ }
+ "phonetically similar arguments" should returns {
+ "Boolean indicating true" in {
+ SoundexMetric.compare("robert", "rupert").get should be (true)
+ }
+ }
+ "phonetically dissimilar arguments" should returns {
+ "Boolean indicating false" in {
+ SoundexMetric.compare("robert", "rubin").get should be (false)
+ }
+ }
+ }
+}}