/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 9 Ġ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 . build . at tribution . analy zers Ċ Ċ import Ġorg . gradle . tool ing . events . Binary Plugin Identifier Ċ import Ġorg . gradle . tool ing . events . Finish Event Ċ import Ġorg . gradle . tool ing . events . Operation Descriptor Ċ import Ġorg . gradle . tool ing . events . Plugin Identifier Ċ import Ġorg . gradle . tool ing . events . Script Plugin Identifier Ċ import Ġorg . gradle . tool ing . events . Success Result Ċ import Ġorg . gradle . tool ing . events . configuration . Project Configuration Finish Event Ċ import Ġorg . gradle . tool ing . events . configuration . Project Configuration Operation Descriptor Ċ import Ġorg . gradle . tool ing . events . configuration . Project Configuration Operation Result Ċ import Ġorg . gradle . tool ing . events . configuration . Project Configuration Start Event Ċ import Ġorg . gradle . tool ing . events . configuration . Project Configuration Success Result Ċ import Ġorg . gradle . tool ing . events . task . Task Finish Event Ċ import Ġorg . gradle . tool ing . events . task . Task Operation Descriptor Ċ import Ġorg . gradle . tool ing . events . task . Task Success Result Ċ import Ġorg . gradle . tool ing . model . Project Identifier Ċ import Ġorg . mockito . Mockito Ċ import Ġorg . mockito . Mockito .` when ` Ċ Ċ fun Ġcreate Binary Plugin Identifier Stub ( displayName : ĠString , ĠclassName : ĠString ): ĠBinary Plugin Identifier Ġ{ ĊĠ Ġval Ġplugin Identifier Ġ= ĠMockito . mock ( Binary Plugin Identifier :: class . java ) ĊĠ Ġ` when `( plugin Identifier . displayName ). thenReturn ( displayName ) ĊĠ Ġ` when `( plugin Identifier . className ). thenReturn ( className ) ĊĠ Ġreturn Ġplugin Identifier Ċ } Ċ Ċ fun Ġcreate Script Plugin Identifier Stub ( plugin Name : ĠString ): ĠScript Plugin Identifier Ġ{ ĊĠ Ġval Ġplugin Identifier Ġ= ĠMockito . mock ( Script Plugin Identifier :: class . java ) ĊĠ Ġ` when `( plugin Identifier . displayName ). thenReturn ( plugin Name ) ĊĠ Ġreturn Ġplugin Identifier Ċ } Ċ Ċ fun Ġcreate Operation Descriptor Stub ( name : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠdisplayName : ĠString Ġ= Ġname , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġparent : ĠOperation Descriptor ? Ġ= Ġnull ): ĠOperation Descriptor Ġ{ ĊĠ Ġval Ġdescriptor Ġ= ĠMockito . mock ( Operation Descriptor :: class . java ) ĊĠ Ġ` when `( descriptor . name ). thenReturn ( name ) ĊĠ Ġ` when `( descriptor . displayName ). thenReturn ( displayName ) ĊĠ Ġ` when `( descriptor . parent ). thenReturn ( parent ) ĊĠ Ġreturn Ġdescriptor Ċ } Ċ Ċ fun Ġcreate Finish Event Stub ( displayName : ĠString , ĠstartTime : ĠLong , ĠendTime : ĠLong , Ġdescriptor : ĠOperation Descriptor ? Ġ= Ġnull ): ĠFinish Event Ġ{ ĊĠ Ġval Ġevent Ġ= ĠMockito . mock ( Finish Event :: class . java ) ĊĠ Ġval Ġresult Ġ= ĠMockito . mock ( Success Result :: class . java ) ĊĠ Ġ` when `( result . startTime ). thenReturn ( startTime ) ĊĠ Ġ` when `( result . endTime ). thenReturn ( endTime ) ĊĠ Ġ` when `( event . displayName ). thenReturn ( displayName ) ĊĠ Ġ` when `( event . result ). thenReturn ( result ) ĊĠ Ġ` when `( event . descriptor ). thenReturn ( descriptor ) ĊĠ Ġreturn Ġevent Ċ } Ċ Ċ fun Ġcreate Task Operation Descriptor Stub ( task Path : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġorigin Plugin : ĠPlugin Identifier , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdependencies : ĠList < Task Operation Descriptor >): ĠTask Operation Descriptor Ġ{ ĊĠ Ġval Ġtask Operation Descriptor Ġ= ĠMockito . mock ( Task Operation Descriptor :: class . java ) ĊĠ Ġ` when `( task Operation Descriptor . task Path ). thenReturn ( task Path ) ĊĠ Ġ` when `( task Operation Descriptor . origin Plugin ). thenReturn ( origin Plugin ) ĊĠ Ġ` when `( task Operation Descriptor . dependencies ). thenReturn ( dependencies . to Mutable Set ()) ĊĠ Ġreturn Ġtask Operation Descriptor Ċ } Ċ Ċ fun Ġcreate Task Success Result Stub ( task Execution StartTime : ĠLong , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtask Execution EndTime : ĠLong ): ĠTask Success Result Ġ{ ĊĠ Ġval Ġtask Success Result Ġ= ĠMockito . mock ( Task Success Result :: class . java ) ĊĠ Ġ` when `( task Success Result . startTime ). thenReturn ( task Execution StartTime ) ĊĠ Ġ` when `( task Success Result . endTime ). thenReturn ( task Execution EndTime ) ĊĠ Ġreturn Ġtask Success Result Ċ } Ċ Ċ fun Ġcreate Task Finish Event Stub ( task Path : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġorigin Plugin : ĠPlugin Identifier , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdependencies : ĠList < Task Finish Event >, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtask Execution StartTime : ĠLong , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtask Execution EndTime : ĠLong ): ĠTask Finish Event Ġ{ ĊĠ Ġval Ġtask Finish Event Ġ= ĠMockito . mock ( Task Finish Event :: class . java ) ĊĠ Ġval Ġdescriptor Ġ= Ġcreate Task Operation Descriptor Stub ( task Path , Ġorigin Plugin , Ġdependencies . map Ġ{ Ġit . descriptor Ġ}) ĊĠ Ġval Ġresult Ġ= Ġcreate Task Success Result Stub ( task Execution StartTime , Ġtask Execution EndTime ) ĊĠ Ġ` when `( task Finish Event . descriptor ). thenReturn ( descriptor ) ĊĠ Ġ` when `( task Finish Event . result ). thenReturn ( result ) ĊĠ Ġreturn Ġtask Finish Event Ċ } Ċ Ċ fun Ġcreate Project Configuration Start Event Stub ( project Path : ĠString ): ĠProject Configuration Start Event Ġ{ ĊĠ Ġval Ġproject Configuration Start Event Ġ= ĠMockito . mock ( Project Configuration Start Event :: class . java ) ĊĊĠ Ġval Ġproject Ġ= ĠMockito . mock ( Project Identifier :: class . java ) ĊĠ Ġ` when `( project . project Path ). thenReturn ( project Path ) ĊĊĠ Ġval Ġdescriptor Ġ= ĠMockito . mock ( Project Configuration Operation Descriptor :: class . java ) ĊĠ Ġ` when `( descriptor . project ). thenReturn ( project ) ĊĊĠ Ġ` when `( project Configuration Start Event . descriptor ). thenReturn ( descriptor ) ĊĠ Ġreturn Ġproject Configuration Start Event Ċ } Ċ Ċ fun Ġcreate Project Configuration Finish Event Stub ( ĊĠ Ġproject Path : ĠString , ĊĠ Ġproject Configuration StartTime : ĠLong , ĊĠ Ġproject Configuration EndTime : ĠLong , ĊĠ Ġapplied Plugins : ĠList < Plugin Identifier > Ċ ): ĠProject Configuration Finish Event Ġ{ ĊĠ Ġval Ġproject Configuration Finish Event Ġ= ĠMockito . mock ( Project Configuration Finish Event :: class . java ) ĊĊĠ Ġval Ġproject Ġ= ĠMockito . mock ( Project Identifier :: class . java ) ĊĠ Ġ` when `( project . project Path ). thenReturn ( project Path ) ĊĊĠ Ġval Ġdescriptor Ġ= ĠMockito . mock ( Project Configuration Operation Descriptor :: class . java ) ĊĠ Ġ` when `( descriptor . project ). thenReturn ( project ) ĊĊĠ Ġval Ġresult Ġ= ĠMockito . mock ( Project Configuration Success Result :: class . java ) ĊĠ Ġ` when `( result . startTime ). thenReturn ( project Configuration StartTime ) ĊĠ Ġ` when `( result . endTime ). thenReturn ( project Configuration EndTime ) ĊĠ Ġval Ġplugin Application Results Ġ= Ġapplied Plugins . map Ġ{ Ġplugin Identifier Ġ-> ĊĠĠĠ ĠMockito . mock ( Project Configuration Operation Result . Plugin Application Result :: class . java ). apply Ġ{ ĊĠĠĠĠĠ Ġ` when `( plugin ). thenReturn ( plugin Identifier ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĠ Ġ` when `( result . plugin Application Results ). thenReturn ( plugin Application Results ) ĊĊĠ Ġ` when `( project Configuration Finish Event . descriptor ). thenReturn ( descriptor ) ĊĠ Ġ` when `( project Configuration Finish Event . result ). thenReturn ( result ) ĊĠ Ġreturn Ġproject Configuration Finish Event Ċ } Ċ