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

	"AsciiLetterNumberFilter" should provide {
		"overloaded filter method" when passed {
			"String with letters and numbers" should returns {
				"String with letters and numbers removed" in {
					Filter.filter("	Hello123World!") should equal ("	!")
					Filter.filter("Hello123	!World") should equal ("	!")
					Filter.filter("!Hello123World	") should equal ("!	")
				}
			}
			"character array with letters and numbers" should returns {
				"character array with letters and numbers removed" in {
					Filter.filter("	Hello123World!".toCharArray) should equal ("	!".toCharArray)
					Filter.filter("Hello123	!World".toCharArray) should equal ("	!".toCharArray)
					Filter.filter("!Hello123World	".toCharArray) should equal ("!	".toCharArray)
				}
			}
		}
	}
}

object AsciiLetterNumberFilterSpec {
	private final val Filter = new StringFilterDelegate with AsciiLetterNumberFilter
}