/* Ċ Ġ* Ġ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 . api . artifact . impl Ċ Ċ import Ġcom . android . build . api . artifact . Artifact Kind Ċ import Ġcom . android . build . api . artifact . Artifact Type Ċ import Ġcom . google . common . truth . Truth Ċ import Ġorg . gradle . api . file . Directory Ċ import Ġorg . gradle . api . file . Directory Property Ċ import Ġorg . gradle . api . file . FileSystem Location Ċ import Ġorg . gradle . api . file . Regular File Ċ import Ġorg . gradle . api . file . Regular File Property Ċ import Ġorg . gradle . api . model . ObjectFactory Ċ import Ġorg . gradle . api . provider . List Property Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . mockito . Argument Matchers Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . Mockito .` when ` Ċ import Ġorg . mockito . Mockito Annotations Ċ Ċ /** Ċ Ġ* ĠUnit ĠTests Ġfor Ġ[ Storage Provider Impl ] Ċ Ġ*/ Ċ class ĠStorage Provider Impl Test Ġ{ ĊĊĠĠĠ Ġ@ Mock Ġlateinit Ġvar Ġobjects : ĠObject Factory ĊĠĠĠ Ġ@ Mock Ġlateinit Ġvar Ġfile Property : ĠRegular File Property ĊĠĠĠ Ġ@ Mock Ġlateinit Ġvar Ġfiles Property : ĠList Property < Regular File > ĊĠĠĠ Ġ@ Mock Ġlateinit Ġvar Ġdirectory Property : ĠDirectory Property ĊĠĠĠ Ġ@ Mock Ġlateinit Ġvar Ġdirectories Property : ĠList Property < Directory > ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ ĠMockito Annotations . init Mocks ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsealed Ġclass ĠTest Types < T : ĠFileSystem Location >( kind : ĠArtifact Kind < T >): ĠArtifact Type < T >( kind ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġoverride Ġval Ġis Public = false ĊĊĠĠĠĠĠĠĠ Ġobject ĠS INGLE _ FILE : ĠTest Types < Regular File >( Artifact Kind . FILE ), ĠSingle ĊĠĠĠĠĠĠĠ Ġobject ĠS INGLE _ DIRECTORY : ĠTest Types < Directory >( Artifact Kind . DIRECTORY ), ĠSingle ĊĠĠĠĠĠĠĠ Ġobject ĠMULTI PLE _ FILES : ĠTest Types < Regular File >( Artifact Kind . FILE ), ĠMultiple ĊĠĠĠĠĠĠĠ Ġobject ĠMULTI PLE _ DIRECT OR I ESS : ĠTest Types < Directory >( Artifact Kind . DIRECTORY ), ĠMultiple ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġsingle File Allocation Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġ` when `( objects . property ( Argument Matchers . eq ( Regular File :: class . java ))). thenReturn ( file Property ) ĊĠĠĠĠĠĠĠ Ġval Ġstorage Ġ= ĠStorage Provider Impl (). get Storage ( Artifact Kind . FILE ) ĊĠĠĠĠĠĠĠ Ġval Ġartifact Ġ= Ġstorage . get Artifact ( objects , ĠTest Types . SINGLE _ FILE ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact . getCurrent (). isPresent ). isFalse () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġsingle Directory Allocation Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġ` when `( objects . property ( Argument Matchers . eq ( Directory :: class . java ))). thenReturn ( directory Property ) ĊĠĠĠĠĠĠĠ Ġval Ġstorage Ġ= ĠStorage Provider Impl (). get Storage ( Artifact Kind . DIRECTORY ) ĊĠĠĠĠĠĠĠ Ġval Ġartifact Ġ= Ġstorage . get Artifact ( objects , ĠTest Types . SINGLE _ DIRECTORY ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact . getCurrent (). isPresent ). isFalse () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġmultiple Files Allocation Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġ` when `( objects . list Property ( Argument Matchers . eq ( Regular File :: class . java ))). thenReturn ( files Property ) ĊĠĠĠĠĠĠĠ Ġval Ġstorage Ġ= ĠStorage Provider Impl (). get Storage ( Artifact Kind . FILE ) ĊĠĠĠĠĠĠĠ Ġval Ġartifact Ġ= Ġstorage . get Artifact ( objects , ĠTest Types . MULTIPLE _ FILES ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact . getCurrent (). isPresent ). isFalse () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġmultiple Directories Allocation Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġ` when `( objects . list Property ( Argument Matchers . eq ( Directory :: class . java ))). thenReturn ( directories Property ) ĊĠĠĠĠĠĠĠ Ġval Ġstorage Ġ= ĠStorage Provider Impl (). get Storage ( Artifact Kind . DIRECTORY ) ĊĠĠĠĠĠĠĠ Ġval Ġartifact Ġ= Ġstorage . get Artifact ( objects , ĠTest Types . MULTIPLE _ DIRECT OR I ESS ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact . getCurrent (). isPresent ). isFalse () ĊĠĠĠ Ġ} Ċ }