summaryrefslogblamecommitdiff
path: root/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedsoundexalgorithmSpec.scala
blob: 18d46fa4fd6af92956b579c468c2d0bb7aa7d5d5 (plain) (tree)
1
2
3
4
5
6
7
                                                 
 
                                                 



                                      




                                                                                                      
 


                                                                                                           
 

                                                                    
 


                                                                                                         
 

                                                                              
                         





                                                                                                    


                         
  
package com.rockymadden.stringmetric.cli.phonetic

import com.rockymadden.stringmetric.cli.ScalaTest
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner

@RunWith(classOf[JUnitRunner])
final class refinedsoundexalgorithmSpec extends ScalaTest { "refinedsoundexalgorithm" should provide {
	"main method" when passed {
		"valid dashless argument" should executes {
			"print phonetic representation" in {
				val out = new java.io.ByteArrayOutputStream()

				Console.withOut(out)(
					refinedsoundexalgorithm.main(Array("--unitTest", "--debug", "abc"))
				)

				out.toString should equal ("a013\n")
				out.reset()

				Console.withOut(out)(
					refinedsoundexalgorithm.main(Array("--unitTest", "--debug", "1"))
				)

				out.toString should equal ("not computable\n")
				out.reset()
			}
		}
		"no dashless argument" should throws {
			"IllegalArgumentException" in {
				evaluating {
					refinedsoundexalgorithm.main(Array("--unitTest", "--debug"))
				} should produce [IllegalArgumentException]
			}
		}
	}
}}