/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 2 1 ĠThe ĠAndroid ĠOpen ĠSource ĠProject Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . android . tools . idea . gradle . project . upgrade Ċ Ċ import Ġcom . android . ide . common . repository . Gradle Version Ċ import Ġcom . google . common . truth . Expect Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . test Framework . Runs In Ed t Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ Ċ @ Runs In Ed t Ċ class ĠRemove Build Type Use Pro guard Ref actor ing Processor Test Ġ: ĠUpgrade Gradle File Model TestCase () Ġ{ ĊĠ Ġ@ get : Rule ĊĠ Ġval Ġexpect : ĠExpect Ġ= ĠExpect . create And Enable StackTrace () ĊĊĠ Ġfun ĠRemove Build Type Use Pro guard Ref actor ing Processor ( project : ĠProject , Ġcurrent : ĠGradle Version , Ġnew : ĠGradle Version ) Ġ= ĊĠĠĠ ĠREMOVE _ BUILD _ TYPE _ USE _ PRO GU ARD _ INFO . Ref actor ing Processor ( project , Ġcurrent , Ġnew ) ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Ne cess ities () Ġ{ ĊĠĠĠ Ġval Ġexpected Ne cess ities Map Ġ= Ġmap Of ( ĊĠĠĠĠĠ Ġ(" 3 . 3 . 0 " Ġto Ġ" 3 . 4 . 0 ") Ġto ĠA gp Upgrade Component Ne cess ity . IR RE LE V ANT _ F UT URE , ĊĠĠĠĠĠ Ġ(" 3 . 3 . 0 " Ġto Ġ" 3 . 5 . 0 ") Ġto ĠA gp Upgrade Component Ne cess ity . OPTIONAL _ CODE PEND ENT , ĊĠĠĠĠĠ Ġ(" 3 . 6 . 0 " Ġto Ġ" 4 . 2 . 0 ") Ġto ĠA gp Upgrade Component Ne cess ity . OPTIONAL _ INDEP END ENT , ĊĠĠĠĠĠ Ġ(" 4 . 2 . 0 " Ġto Ġ" 7 . 0 . 0 ") Ġto ĠA gp Upgrade Component Ne cess ity . M AND AT ORY _ INDEP END ENT , ĊĠĠĠĠĠ Ġ(" 3 . 3 . 0 " Ġto Ġ" 7 . 0 . 0 ") Ġto ĠA gp Upgrade Component Ne cess ity . M AND AT ORY _ CODE PEND ENT , ĊĠĠĠĠĠ Ġ(" 7 . 0 . 0 " Ġto Ġ" 7 . 1 . 0 ") Ġto ĠA gp Upgrade Component Ne cess ity . IR RE LE V ANT _ P AST ĊĠĠĠ Ġ) ĊĠĠĠ Ġexpected Ne cess ities Map . forEach Ġ{ Ġ( t , Ġu ) Ġ-> ĊĠĠĠĠĠ Ġval Ġprocessor Ġ= ĠRemove Build Type Use Pro guard Ref actor ing Processor ( project , ĠGradle Version . parse ( t . first ), ĠGradle Version . parse ( t . second )) ĊĠĠĠĠĠ Ġexpect . that ( processor . ne cess ity ()). isEqualTo ( u ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Remove Use Pro guard One Build Type () Ġ{ ĊĠĠĠ ĠwriteTo Build File ( Test FileName (" Remove Build Type Use Pro guard / One Build Type ")) ĊĠĠĠ Ġval Ġprocessor Ġ= ĠRemove Build Type Use Pro guard Ref actor ing Processor ( project , ĠGradle Version . parse (" 4 . 2 . 0 "), ĠGradle Version . parse (" 7 . 0 . 0 ")) ĊĠĠĠ Ġprocessor . run () ĊĠĠĠ Ġverify File Contents ( build File , ĠTest FileName (" Remove Build Type Use Pro guard / One Build Type Expected ")) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Remove Use Pro guard Two Build Types () Ġ{ ĊĠĠĠ ĠwriteTo Build File ( Test FileName (" Remove Build Type Use Pro guard / Two Build Types ")) ĊĠĠĠ Ġval Ġprocessor Ġ= ĠRemove Build Type Use Pro guard Ref actor ing Processor ( project , ĠGradle Version . parse (" 4 . 2 . 0 "), ĠGradle Version . parse (" 7 . 0 . 0 ")) ĊĠĠĠ Ġprocessor . run () ĊĠĠĠ Ġverify File Contents ( build File , ĠTest FileName (" Remove Build Type Use Pro guard / Two Build Types Expected ")) ĊĠ Ġ} Ċ }