summaryrefslogtreecommitdiff
path: root/core/src/test/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexMetricSpec.scala
blob: 84f547a71c776b6d7e316aa62379251755132bc3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 RefinedSoundexMetricSpec extends ScalaTest { "RefinedSoundexMetric" should provide {
	"compare method" when passed {
		"empty arguments" should returns {
			"None" in {
				RefinedSoundexMetric.compare("", "").isDefined should be (false)
				RefinedSoundexMetric.compare("abc", "").isDefined should be (false)
				RefinedSoundexMetric.compare("", "xyz").isDefined should be (false)
			}
		}
		"non-phonetic arguments" should returns {
			"None" in {
				RefinedSoundexMetric.compare("123", "123").isDefined should be (false)
				RefinedSoundexMetric.compare("123", "").isDefined should be (false)
				RefinedSoundexMetric.compare("", "123").isDefined should be (false)
			}
		}
		"phonetically similar arguments" should returns {
			"Boolean indicating true" in {
				RefinedSoundexMetric.compare("robert", "rupert").get should be (true)
			}
		}
		"phonetically dissimilar arguments" should returns {
			"Boolean indicating false" in {
				RefinedSoundexMetric.compare("robert", "rubin").get should be (false)
			}
		}
	}
}}