// Ġ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 . stats . completion Ċ Ċ import Ġcom . intellij . code Insight . completion . Light Fixture Completion TestCase Ċ import Ġcom . intellij . ide . highlighter . Java FileType Ċ import Ġcom . intellij . lang . Language Ċ import Ġcom . intellij . openapi . application . Application Manager Ċ import Ġcom . intellij . stats . completion . events . Completion Started Event Ċ import Ġcom . intellij . stats . completion . events . Log Event Ċ import Ġcom . intellij . test Framework . replace Service Ċ import Ġorg . assertj . core . api . Assertions Ċ import Ġorg . mockito . Mockito Ċ Ċ const Ġval Ġrunnable Interface Ġ= Ġ" interface ĠRunnable Ġ{ Ġvoid Ġrun (); Ġvoid Ġrun Fast (); Ġ}" Ċ const Ġval Ġtest Text Ġ= Ġ""" Ċ class ĠTest Ġ{ ĊĠĠĠ Ġpublic Ġvoid Ġrun () Ġ{ ĊĠĠĠĠĠĠĠ ĠRunnable Ġr Ġ= Ġnew ĠRunnable () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpublic Ġvoid Ġrun () Ġ{} ĊĠĠĠĠĠĠĠ Ġ}; ĊĠĠĠĠĠĠĠ Ġr < caret > ĊĠĠĠ Ġ} Ċ } Ċ """ Ċ Ċ fun ĠList < Log Event >. assert Order ( var arg Ġactions : ĠAction ) Ġ{ ĊĠ Ġval Ġcompletion Events Ġ= Ġfilter Ġ{ Ġit . action Type Ġ!= ĠAction . CUSTOM Ġ} ĊĠ ĠAssertions . assertThat ( completion Events . size ). isEqualTo ( actions . size ) ĊĠ Ġcompletion Events . zip ( actions ). forEach Ġ{ Ġ( event , Ġaction ) Ġ-> ĊĠĠĠ ĠAssertions . assertThat ( event . action Type ). isEqualTo ( action ) ĊĠ Ġ} Ċ } Ċ Ċ abstract Ġclass ĠCompletion Logging TestBase Ġ: ĠLight Fixture Completion TestCase () Ġ{ ĊĠ Ġval Ġtracked Events Ġ= Ġmutable ListOf < Log Event >() ĊĊĠ Ġprivate Ġlateinit Ġvar Ġmock Logger Provider : ĠCompletion Logger Provider ĊĊĠ Ġval Ġcompletion Started Event : ĠCompletion Started Event ĊĠĠĠ Ġget () Ġ= Ġtracked Events . first () Ġas ĠCompletion Started Event ĊĊĠ Ġopen Ġfun Ġcompletion File Logger (): ĠCompletion File Logger Ġ{ ĊĠĠĠ Ġval Ġevent Logger Ġ= Ġobject Ġ: ĠCompletion Event Logger Ġ{ ĊĠĠĠĠĠ Ġoverride Ġfun Ġlog ( event : ĠLog Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtracked Events . add ( event ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn ĠCompletion File Logger (" installation - uid ", Ġ" completion - uid ", Ġ" 0 ", ĠLanguage . ANY , Ġevent Logger ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun ĠsetUp () Ġ{ ĊĠĠĠ Ġsuper . setUp () ĊĊĠĠĠ Ġtracked Events . clear () ĊĊĠĠĠ Ġmock Logger Provider Ġ= ĠMockito . mock ( Completion Logger Provider :: class . java ) ĊĠĠĠ ĠMockito .` when `( mock Logger Provider . new Completion Logger ( any ())). thenReturn ( completion File Logger ()) ĊĠĠĠ ĠApplication Manager . getApplication (). replace Service ( Completion Logger Provider :: class . java , Ġmock Logger Provider , Ġtest Root Disposable ) ĊĊĠĠĠ Ġmy Fixture . addClass ( run nable Interface ) ĊĠĠĠ Ġmy Fixture . configure By Text ( Java FileType . INSTANCE , Ġtest Text ) ĊĊĠĠĠ ĠCompletion Tracker Initializer . isEnabled In Tests Ġ= Ġtrue ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun ĠtearDown () Ġ{ ĊĠĠĠ ĠCompletion Tracker Initializer . isEnabled In Tests Ġ= Ġfalse ĊĊĠĠĠ Ġsuper . te ar Down () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġ< T > Ġany (): ĠT Ġ= ĠMockito . any () Ċ } ĊĊ