blob: 1cce0c9a7f890d374731301dfe199868c35a10e7 (
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 AsciiControlFilterSpec extends ScalaTest {
import AsciiControlFilterSpec.Filter
"AsciiControlFilter" should provide {
"overloaded filter method" when passed {
"String with controls" should returns {
"String with controls removed" in {
Filter.filter(" HelloWorld") should equal ("HelloWorld")
Filter.filter("HelloWorld ") should equal ("HelloWorld")
Filter.filter("Hello World") should equal ("HelloWorld")
}
}
"character array with controls" should returns {
"character array with controls removed" in {
Filter.filter(" HelloWorld".toCharArray) should equal ("HelloWorld".toCharArray)
Filter.filter("HelloWorld ".toCharArray) should equal ("HelloWorld".toCharArray)
Filter.filter("Hello World".toCharArray) should equal ("HelloWorld".toCharArray)
}
}
}
}
}
object AsciiControlFilterSpec {
private final val Filter = new StringFilterDelegate with AsciiControlFilter
}
|