package Ġnet . d ank ito . documents . search Ċ Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġjava . util . concurrent . Count DownLatch Ċ import Ġjava . util . concurrent . TimeUnit Ċ import Ġjava . util . concurrent . atomic . Atomic Reference ĊĊ Ċ internal Ġclass ĠElasticsearch Documents Searcher Test Ġ{ ĊĊ ĉ private Ġval Ġunder Test Ġ= ĠElasticsearch Documents Searcher (" 1 9 2 . 1 6 8 . 1 7 8 . 3 2 ", Ġ 6 2 0 0 ) ĊĊĊ ĉ @ Test Ċ ĉ fun Ġsearch () Ġ{ ĊĊĉ ĉ // Ġgiven Ċĉ ĉ val Ġsearch Result Ġ= ĠAtomic Reference < SearchResult >() Ċĉ ĉ val Ġcount DownLatch Ġ= ĠCount DownLatch ( 1 ) ĊĊĊĉ ĉ // Ġwhen Ċĉ ĉ under Test . search Async (" ticket ") Ġ{ Ġresult Ġ-> Ċĉĉ ĉ search Result . set ( result ) Ċĉĉ ĉ count DownLatch . count Down () Ċĉ ĉ } ĊĊĊĉ ĉ // Ġthen Ċĉ ĉ count DownLatch . await ( 2 0 , ĠTimeUnit . SECONDS ) Ċ ĉ } Ċ Ċ }