blob: d727145b49995e3313ad34f07911a3feb836d4db (
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
|
package com.rockymadden.stringmetric
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
final class AlgorithmSpec extends ScalaTest {
import phonetic._
import Algorithm._
import Transform.StringTransform
"StringAlgorithm" should provide {
"compute method and companion object pass through" in {
StringAlgorithm.computeWithMetaphone("testone").get should
equal (MetaphoneAlgorithm.compute("testone".toCharArray).get)
StringAlgorithm.computeWithNysiis("testone").get should
equal (NysiisAlgorithm.compute("testone".toCharArray).get)
StringAlgorithm.computeWithRefinedNysiis("testone").get should
equal (RefinedNysiisAlgorithm.compute("testone".toCharArray).get)
StringAlgorithm.computeWithRefinedSoundex("testone").get should
equal (RefinedSoundexAlgorithm.compute("testone".toCharArray).get)
StringAlgorithm.computeWithSoundex("testone").get should
equal (SoundexAlgorithm.compute("testone".toCharArray).get)
}
}
"StringAlgorithmDecorator" should provide {
"withTransform()" in {
(MetaphoneAlgorithm withTransform StringTransform.filterAlpha).compute("abc123").get should
equal (MetaphoneAlgorithm.compute("abc").get)
}
}
}
|