summaryrefslogtreecommitdiff
path: root/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedsoundexmetricSpec.scala
blob: e7c6d2d2ae192993f61acdecc37cfcfe73da6209 (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
package com.rockymadden.stringmetric.cli.phonetic

object refinedsoundexmetricSpec extends org.specs2.mutable.SpecificationWithJUnit {
	"refinedsoundexmetric main()" should {
		"print if they are a match with valid dashless arguments" in {
			val out = new java.io.ByteArrayOutputStream()

			Console.withOut(out)(refinedsoundexmetric.main(Array("--unitTest", "--debug", "abc", "abc")))
			out.toString must beEqualTo("true\n")
			out.reset()

			Console.withOut(out)(refinedsoundexmetric.main(Array("--unitTest", "--debug", "abc", "xyz")))
			out.toString must beEqualTo("false\n")
			out.reset()

			Console.withOut(out)(refinedsoundexmetric.main(Array("--unitTest", "--debug", "1", "1")))
			out.toString must beEqualTo("not comparable\n")
		}
		"throw IllegalArgumentException with no dashless arguments" in {
			refinedsoundexmetric.main(Array("--unitTest", "--debug")) must throwA[IllegalArgumentException]
		}
	}
}