summaryrefslogtreecommitdiff
path: root/core/source/test/scala/com/rockymadden/stringmetric/filter/AsciiSymbolFilterSpec.scala
blob: 99be533020ad84a33c33099425c4aecfa131cf39 (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
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 AsciiSymbolFilterSpec extends ScalaTest {
	import AsciiSymbolFilterSpec.Filter

	"AsciiSymbolFilter" should provide {
		"overloaded filter method" when passed {
			"String with symbols" should returns {
				"String with symbols removed" in {
					Filter.filter("[HelloWorld]") should equal ("HelloWorld")
					Filter.filter("Hello!World") should equal ("HelloWorld")
				}
			}
			"character array with symbols" should returns {
				"character array with symbols removed" in {
					Filter.filter("[HelloWorld]".toCharArray) should equal ("HelloWorld".toCharArray)
					Filter.filter("Hello!World".toCharArray) should equal ("HelloWorld".toCharArray)
				}
			}
		}
	}
}

object AsciiSymbolFilterSpec {
	private final val Filter = new StringFilterDelegate with AsciiSymbolFilter
}