package Ġcom . m ga et an 8 9 . show sr age . fragment Ċ Ċ import Ġandroid . app . Search Manager Ċ import Ġandroid . content . Intent Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . junit . runners . Parameterized Ċ import Ġorg . mockito . Argument Matchers . any String Ċ import Ġorg . mockito . Mockito .` when ` Ċ import Ġorg . mockito . Mockito . mock Ċ Ċ @ RunWith ( Parameterized :: class ) Ċ class ĠAdd Show Fragment _ Get Query From Intent Test ( val Ġintent : ĠIntent ?, Ġval Ġquery : ĠString ) Ġ{ Ċ ĉ @ Test Ċ ĉ fun Ġget Query From Intent () Ġ{ Ċĉ ĉ if Ġ( this . intent Ġ!= Ġnull ) Ġ{ Ċĉĉ ĉ ` when `( this . intent . getString Extra ( Search Manager . QUERY )). thenReturn ( this . query ) Ċĉ ĉ } ĊĊĉ ĉ assertThat ( Add Show Fragment . getQuery From Intent ( this . intent )). isEqualTo ( this . query ) Ċ ĉ } ĊĊ ĉ comp anion Ġobject Ġ{ Ċĉ ĉ @ Jvm Static Ċĉ ĉ @ Parameterized . Parameters Ċĉ ĉ fun Ġdata (): ĠCollection < Array < Any ? >> Ġ{ Ċĉĉ ĉ return ĠlistOf ( Ċĉĉĉĉ ĉ array Of < Any ? >( null , Ġ""), Ċĉĉĉĉ ĉ array Of < Any ? >( getMock ed Intent ( Intent . ACTION _ DI AL ), Ġ""), Ċĉĉĉĉ ĉ array Of < Any ? >( getMock ed Intent ( Intent . ACTION _ SEARCH ), Ġ""), Ċĉĉĉĉ ĉ array Of < Any ? >( getMock ed Intent ( Intent . ACTION _ SEARCH ). putExtra ( Search Manager . QUERY , Ġnull Ġas ĠString ? ), Ġ""), Ċĉĉĉĉ ĉ array Of < Any ? >( getMock ed Intent ( Intent . ACTION _ SEARCH ). putExtra ( Search Manager . QUERY , Ġ""), Ġ""), Ċĉĉĉĉ ĉ array Of < Any ? >( getMock ed Intent ( Intent . ACTION _ SEARCH ). putExtra ( Search Manager . QUERY , Ġ" Some Ġquery "), Ġ" Some Ġquery ") Ċĉĉ ĉ ) Ċĉ ĉ } ĊĊĉ ĉ private Ġfun Ġget Mock ed Intent ( action : ĠString ): ĠIntent Ġ{ Ċĉĉ ĉ val Ġintent Ġ= Ġmock ( Intent :: class . java ) Ċĉĉ ĉ ` when `( intent . putExtra ( any String (), Ġany String ())). thenReturn ( intent ) Ċĉĉ ĉ ` when `( intent . action ). thenReturn ( action ) ĊĊĉĉ ĉ return Ġintent Ċĉ ĉ } Ċ ĉ } Ċ } Ċ