// ĠCopyright Ġ 2 0 0 0 - 2 0 1 9 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġcom . intellij . test Framework Ċ Ċ import Ġcom . intellij . lang . Language Ċ import Ġcom . intellij . lang . Language Extension Ċ import Ġcom . intellij . mock . Mock Application Ċ import Ġcom . intellij . openapi . application . Application Manager Ċ import Ġcom . intellij . openapi . extensions . impl . Extension Point Impl Ċ import Ġcom . intellij . openapi . extensions . impl . Extensions Area Impl Ċ import Ġcom . intellij . openapi . util . Key ed Extension Collector Ċ import Ġcom . intellij . util . Key ed Lazy Instance Ċ import Ġjava . util . function . Predicate Ċ Ċ object ĠExtension TestUtil Ġ{ ĊĠ Ġ@ Jvm Static ĊĠ Ġfun Ġ< T > Ġadd Extension ( area : ĠExtensions Area Impl , Ġcollector : ĠLanguage Extension < T >, Ġlanguage : ĠLanguage , Ġinstance : ĠT ) Ġ{ ĊĠĠĠ Ġadd Extension ( area , Ġcollector , Ġlanguage . id , Ġinstance ) ĊĠ Ġ} ĊĊĠ Ġ@ Jvm Static ĊĠ Ġfun Ġ< T , ĠKey T > Ġadd Extension ( area : ĠExtensions Area Impl , Ġcollector : ĠKey ed Extension Collector < T , ĠKey T >, Ġkey : ĠString , Ġinstance : ĠT ) Ġ{ ĊĠĠĠ Ġval Ġpoint Ġ= Ġarea . getExtension Point < Key ed Lazy Instance < T >>( collector . name ) ĊĊĠĠĠ Ġif Ġ( Application Manager . getApplication () Ġ! is ĠMock Application ) Ġ{ ĊĠĠĠĠĠ Ġ// Ġif Ġnot ĠMock Application , Ġit Ġmeans Ġthat Ġextension Ġpoint Ġis Ġnot Ġregistered Ġas Ġfake Ġbean ĊĠĠĠĠĠ ĠExtension Point Impl . set Test Type Checker ( Predicate Ġ{ ĠKey ed Lazy Instance :: class . java . isAssignableFrom ( it ) Ġ}, ĠApplication Manager . getApplication ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġpoint . register Extension ( object Ġ: ĠKey ed Lazy Instance < T > Ġ{ ĊĠĠĠĠĠ Ġoverride Ġfun ĠgetKey () Ġ= Ġkey ĊĊĠĠĠĠĠ Ġoverride Ġfun ĠgetInstance () Ġ= Ġinstance ĊĠĠĠ Ġ}) ĊĠĠĠ Ġcollector . clear Cache () ĊĠ Ġ} Ċ }