package Ġorg . cc ci . g to . android . common . sc ar let . action c able Ċ Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . any Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . wh enever Ċ import Ġcom . t inder . sc ar let . Message Adapter Ċ import Ġorg . cc ci . g to . android . common . sc ar let . action c able . model . Message Ċ import Ġorg . junit . Before Ċ Ċ abstract Ġclass ĠBase Action Cable Message Adapter Test Ġ{ ĊĠĠĠ Ġprotected Ġlateinit Ġvar Ġfactory : ĠMessage Adapter . Factory ĊĊĠĠĠ Ġprotected Ġlateinit Ġvar Ġdata Message Adapter Factory : ĠMessage Adapter . Factory ĊĠĠĠ Ġprotected Ġlateinit Ġvar Ġdata Message Adapter : ĠMessage Adapter < Any > ĊĊĠĠĠ Ġprotected Ġval Ġaction Cable Annotation Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠAn notations :: class . java . getDeclared Method (" action Cable "). annotations . action Cable Message !! ĊĠĠĠ Ġ} ĊĠĠĠ Ġprotected Ġval Ġdata As Json Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠAn notations :: class . java . getDeclared Method (" data As Json "). annotations . action Cable Serialize Data As Json !! ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup Factory () Ġ{ ĊĠĠĠĠĠĠĠ Ġdata Message Adapter Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġdata Message Adapter Factory Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġwhenever ( data Message Adapter Factory . create ( any (), Ġany ())). thenReturn ( data Message Adapter ) ĊĊĠĠĠĠĠĠĠ Ġfactory Ġ= ĠAction Cable Message Adapter Factory . Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. addMessage Adapter Factory ( data Message Adapter Factory ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprotected Ġinterface ĠMessage Parameterized Types Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġnot Parameterized (): ĠMessage < *> ĊĠĠĠĠĠĠĠ Ġfun Ġchar Sequence Parameterized (): ĠMessage < CharSequence > ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprotected Ġinline Ġfun Ġ< re ified ĠT Ġ: ĠAny > Ġgeneric Return TypeOf ( method : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ ĠT :: class . java . getDeclared Method ( method ). generic ReturnType Ċ } Ċ Ċ private Ġinterface ĠAn notations Ġ{ ĊĠĠĠ Ġ@ Action Cable Message (" valid ") ĊĠĠĠ Ġfun Ġaction Cable () ĊĊĠĠĠ Ġ@ Action Cable Serialize Data As Json ĊĠĠĠ Ġfun Ġdata As Json () Ċ } Ċ