/******************************************************************************* Ċ Ġ* Ċ Ġ* ĠCopyright Ġ( c ) Ġ{ 2 0 0 3 - 2 0 2 1 } ĠM ure x ĠS . A . S . Ġand Ġits Ġaffiliates . Ċ Ġ* ĠAll Ġrights Ġreserved . ĠThis Ġprogram Ġand Ġthe Ġaccompanying Ġmaterials Ċ Ġ* Ġare Ġmade Ġavailable Ġunder Ġthe Ġterms Ġof Ġthe ĠMIT ĠLicense Ċ Ġ* Ġwhich Ġaccomp anies Ġthis Ġdistribution , Ġand Ġis Ġavailable Ġat Ċ Ġ* Ġhttps :// opensource . org / licenses / MIT Ċ Ġ* Ċ Ġ************************************************************************* ******/ Ċ Ċ package Ġcom . m ure x . tb w . finance Ċ Ċ import Ġcom . m ure x . tb w . domain . book .* Ċ import Ġcom . m ure x . tb w . domain . country . Country Ċ import Ġcom . m ure x . tb w . domain . country . Currency .* Ċ import Ġcom . m ure x . tb w . domain . country . Language Ċ import Ġcom . m ure x . tb w . domain . country . Language .* Ċ import Ġcom . m ure x . tb w . finance . Tax Rules Operations . Converter . get Applicable Rate Ċ import Ġorg . junit . jupiter . api . Assertions .* Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . assert Throws Ċ import Ġorg . junit . jupiter . params . Parameterized Test Ċ import Ġorg . junit . jupiter . params . provider . Arguments Ċ import Ġorg . junit . jupiter . params . provider . Method Source Ċ import Ġjava . util . stream . Stream Ċ Ċ private Ġval ĠA U STR AL IA Ġ= ĠCountry (" A ustralia ", ĠA U STR ALI AN _ DO LL AR , ĠEN GL ISH ) Ċ private Ġval ĠCH INA Ġ= ĠCountry (" China ", ĠR EN MIN BI , ĠM AND AR IN ) Ċ private Ġval ĠF RAN CE Ġ= ĠCountry (" Fr ance ", ĠEU RO , ĠF REN CH ) Ċ private Ġval ĠG ER MAN Y Ġ= ĠCountry (" Ger many ", ĠEU RO , ĠG ER MAN ) Ċ private Ġval ĠJ AP AN Ġ= ĠCountry (" J apan ", ĠY EN , ĠJ AP ANE SE ) Ċ private Ġval ĠSP AIN Ġ= ĠCountry (" Sp ain ", ĠEU RO , ĠSP AN ISH ) Ċ private Ġval ĠUK Ġ= ĠCountry (" UK ", ĠPO UND _ STER LING , ĠEN GL ISH ) Ċ private Ġval ĠUSA Ġ= ĠCountry (" USA ", ĠUS _ DO LL AR , ĠEN GL ISH ) Ċ private Ġval ĠF REN CH _ WR ITER Ġ= ĠAuthor (" F rench ĠAuthor ", ĠF RAN CE ) Ċ Ċ internal Ġclass ĠTax Rules Operations Test Ġ{ ĊĊĠĠĠ Ġ@ Parameterized Test ( name Ġ= Ġ" By Ġdefault Ġthe Ġtax Ġrate Ġfor Ġ\" { 0 }\" Ġshould Ġbe Ġ\" { 1 }\" ") ĊĠĠĠ Ġ@ Method Source (" default Tax Rates ") ĊĠĠĠ Ġfun Ġwhen Restrictions Apply It Should Return The Default Tax Rates ( country : ĠCountry , Ġtax Rate : ĠDouble , Ġlanguage : ĠLanguage ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbook Ġ= ĠEduc ational Book (" Learn ĠNew ĠLanguage ", Ġ 2 0 . 0 , ĠF REN CH _ WR ITER , Ġlanguage , ĠCategory . LANGUAGE ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( tax Rate , Ġget Applicable Rate ( country , Ġbook )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġ@ Jvm Static ĊĠĠĠĠĠĠĠ Ġfun Ġdefault Tax Rates (): ĠStream < Arguments >? Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠStream . of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArguments . of ( USA , Ġ 1 . 1 5 , ĠF REN CH ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArguments . of ( F RAN CE , Ġ 1 . 2 5 , ĠF REN CH ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArguments . of ( UK , Ġ 1 . 2 0 , ĠF REN CH ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArguments . of ( SP AIN , Ġ 1 . 1 0 , ĠSP AN ISH ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArguments . of ( CH INA , Ġ 1 . 3 5 , ĠM AND AR IN ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArguments . of ( J AP AN , Ġ 1 . 3 0 , ĠM AND AR IN ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArguments . of ( AU STR AL IA , Ġ 1 . 1 3 , ĠF REN CH ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArguments . of ( GER MAN Y , Ġ 1 . 2 2 , ĠF REN CH ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġit Should Throw An Exception If The Invoice Country IsNot Valid () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġauthor Ġ= ĠAuthor (" G unter ĠGr ass ", ĠG ER MAN Y ) ĊĠĠĠĠĠĠĠ Ġval Ġnovel Ġ= ĠNo vel (" The ĠT in ĠD rum ", Ġ 2 0 . 0 , Ġauthor , ĠG ER MAN , Ġempty List ()) ĊĠĠĠĠĠĠĠ Ġval Ġinvalid Country Ġ= ĠCountry (" country ", ĠPO UND _ STER LING , ĠEN GL ISH ) ĊĠĠĠĠĠĠĠ ĠassertThrows < IllegalArgumentException > Ġ{ Ġget Applicable Rate ( invalid Country , Ġnovel ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtax ShouldBe App ended When Both The Author And Invoice Country Are From Ger many () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Rate Applied ( 1 . 0 5 , ĠG ER MAN Y ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtax ShouldBe App ended When The Book Is No vel And The Invoice Country Is USA () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Rate Applied ( 1 . 1 2 7 , ĠUSA ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtax ShouldBe App ended When The Book Is No vel And The Invoice Country Is UK () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Rate Applied ( 1 . 1 1 6 , ĠUK ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġno Tax ShouldBe Applied When The Language Is Foreign And The Invoice Country Is China () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Rate Applied ( 1 . 0 , ĠCH INA ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġno Tax ShouldBe Applied When The Language Is Foreign And The Invoice Country Is Sp ain () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Rate Applied ( 1 . 0 , ĠSP AIN ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġassert Rate Applied ( expected : ĠDouble , Ġcountry : ĠCountry ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġauthor Ġ= ĠAuthor (" G unter ĠGr ass ", ĠG ER MAN Y ) ĊĠĠĠĠĠĠĠ Ġval Ġnovel Ġ= ĠNo vel (" The ĠT in ĠD rum ", Ġ 2 0 . 0 , Ġauthor , ĠG ER MAN , Ġempty List ()) ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected , Ġget Applicable Rate ( country , Ġnovel )) ĊĠĠĠ Ġ} Ċ }