blob: c6f1899f588cfb521656565e6f23ee6c719bc026 (
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
|
package com.rockymadden.stringmetric.filter
import com.rockymadden.stringmetric.ScalaTest
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
final class AsciiSymbolOnlyFilterSpec extends ScalaTest {
import AsciiSymbolOnlyFilterSpec.Filter
"AsciiSymbolOnlyFilter" should provide {
"overloaded filter method" when passed {
"String with mixed characters" should returns {
"String with non-symbols removed" in {
Filter.filter("!@#$%^&*()abc123") should equal ("!@#$%^&*()")
Filter.filter("abc123!@#$%^&*()") should equal ("!@#$%^&*()")
Filter.filter("!@#$%abc123^&*()") should equal ("!@#$%^&*()")
}
}
"character array with mixed characters" should returns {
"character array with non-symbols removed" in {
Filter.filter("!@#$%^&*()abc123".toCharArray) should equal ("!@#$%^&*()".toCharArray)
Filter.filter("abc123!@#$%^&*()".toCharArray) should equal ("!@#$%^&*()".toCharArray)
Filter.filter("!@#$%abc123^&*()".toCharArray) should equal ("!@#$%^&*()".toCharArray)
}
}
}
}
}
object AsciiSymbolOnlyFilterSpec {
private final val Filter = new StringFilterDelegate with AsciiSymbolOnlyFilter
}
|