summaryrefslogtreecommitdiff
path: root/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonemetricSpec.scala
blob: 512406870c6c4bbecb106a2649c9e8c0803ce16f (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 metaphonemetricSpec extends org.specs2.mutable.SpecificationWithJUnit {
	"metaphonemetric main()" should {
		"print if they are a match with valid dashless arguments" in {
			val out = new java.io.ByteArrayOutputStream()

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

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

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