package Ġco . nums . intellij . a em . icons . providers Ċ Ċ import Ġco . nums . intellij . a em . icons . A em Icons Ċ import Ġco . nums . intellij . a em . service . J cr Roots Ċ import Ġco . nums . intellij . a em . test . util . when GetService Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . vfs . Virtual File Ċ import Ġcom . intellij . psi .* Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . jupiter . api .* Ċ import Ġorg . mockito . Mockito . RET URNS _ DE EP _ ST UB S Ċ import Ġorg . mockito . Mockito .` when ` Ċ import Ġorg . mockito . Mockito . mock Ċ Ċ private Ġconst Ġval ĠANY _ FLAGS Ġ= Ġ 0 Ċ Ċ class ĠJ cr Root Icon Provider Test Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġproject : ĠProject ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġj cr Roots : ĠJ cr Roots ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcut : ĠJ cr Root Icon Provider ĊĊĠĠĠ Ġ@ BeforeEach ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġproject Ġ= Ġmock ( Project :: class . java , ĠRET URNS _ DE EP _ ST UB S ) ĊĠĠĠĠĠĠĠ Ġj cr Roots Ġ= Ġmock ( J cr Roots :: class . java ) ĊĠĠĠĠĠĠĠ Ġwhen GetService < J cr Roots >( project ). thenReturn ( j cr Roots ) ĊĠĠĠĠĠĠĠ Ġcut Ġ= ĠJ cr Root Icon Provider () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Return H tl Root Icon When Psi Element Is J cr Root () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpsi Directory Ġ= Ġmock ( Psi Directory :: class . java , ĠRET URNS _ DE EP _ ST UB S ) ĊĠĠĠĠĠĠĠ Ġ` when `( psi Directory . virtual File ). thenReturn ( mock ( Virtual File :: class . java )) ĊĠĠĠĠĠĠĠ Ġ` when `( psi Directory . project ). thenReturn ( project ) ĊĠĠĠĠĠĠĠ Ġ` when `( j cr Roots . is J cr Content Root ( psi Directory . virtual File )). thenReturn ( true ) ĊĊĠĠĠĠĠĠĠ Ġval Ġicon Ġ= Ġcut . get Icon ( psi Directory , ĠANY _ FLAGS ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( icon ). isEqualTo ( A em Icons . J CR _ ROOT _ DIR ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Return Null Icon When Psi Element IsNot Directory () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpsi Element Ġ= Ġmock ( Psi Element :: class . java , ĠRET URNS _ DE EP _ ST UB S ) ĊĠĠĠĠĠĠĠ Ġ` when `( psi Element . project ). thenReturn ( project ) ĊĊĠĠĠĠĠĠĠ Ġval Ġicon Ġ= Ġcut . get Icon ( psi Element , ĠANY _ FLAGS ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( icon ). isNull () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Return Null Icon When Psi Directory IsNot J cr Root () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpsi Directory Ġ= Ġmock ( Psi Directory :: class . java , ĠRET URNS _ DE EP _ ST UB S ) ĊĠĠĠĠĠĠĠ Ġ` when `( psi Directory . virtual File ). thenReturn ( mock ( Virtual File :: class . java )) ĊĠĠĠĠĠĠĠ Ġ` when `( psi Directory . project ). thenReturn ( project ) ĊĠĠĠĠĠĠĠ Ġ` when `( j cr Roots . is J cr Content Root ( psi Directory . virtual File )). thenReturn ( false ) ĊĊĠĠĠĠĠĠĠ Ġval Ġicon Ġ= Ġcut . get Icon ( psi Directory , ĠANY _ FLAGS ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( icon ). isNull () ĊĠĠĠ Ġ} Ċ Ċ } Ċ