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

	"AsciiNumberFilter" should provide {
		"overloaded filter method" when passed {
			"String with numbers" should returns {
				"String with numbers removed" in {
					Filter.filter("	Hello123World!") should equal ("	HelloWorld!")
					Filter.filter("123	HelloWorld!") should equal ("	HelloWorld!")
					Filter.filter("	HelloWorld!123") should equal ("	HelloWorld!")
				}
			}
			"character array with numbers" should returns {
				"character array with numbers removed" in {
					Filter.filter("	Hello123World!".toCharArray) should equal ("	HelloWorld!".toCharArray)
					Filter.filter("123	HelloWorld!".toCharArray) should equal ("	HelloWorld!".toCharArray)
					Filter.filter("	HelloWorld!123".toCharArray) should equal ("	HelloWorld!".toCharArray)
				}
			}
		}
	}
}

object AsciiNumberFilterSpec {
	private final val Filter = new StringFilterDelegate with AsciiNumberFilter
}