package Ġcom . radix d lt . client . application . translate Ċ Ċ 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 . radix d lt . client . application . actions . Transfer Tokens Action Ċ import Ġcom . radix d lt . client . application . objects . Token Transfer Ċ import Ġcom . radix d lt . client . assets . Asset Ċ import Ġcom . radix d lt . client . core . Rad ix Un iverse Ċ import Ġcom . radix d lt . client . core . address . Rad ix Address Ċ import Ġcom . radix d lt . client . core . atoms . Abstract Consum able Ċ import Ġcom . radix d lt . client . core . atoms . Atom Builder Ċ import Ġcom . radix d lt . client . core . atoms . Transaction Atom Ċ import Ġcom . radix d lt . client . core . crypto . E CP ublic Key Ċ import Ġcom . radix d lt . client . core . ledger . Particle Store Ċ import Ġio . reactivex . Observable Ċ import Ġio . reactivex . ob servers . Test Observer Ċ import Ġorg . junit . Test Ċ import Ġjava . util . Collections Ċ Ċ class ĠTransfer Tokens Action Translator Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Send To Self Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġuniverse Ġ= Ġmock < Rad ix Un iverse >() ĊĠĠĠĠĠĠĠ Ġval Ġparticle Store Ġ= Ġmock < Particle Store >() ĊĠĠĠĠĠĠĠ Ġval Ġatom Ġ= Ġmock < Transaction Atom >() ĊĠĠĠĠĠĠĠ Ġval Ġmy Key Ġ= Ġmock < E CP ublic Key >() ĊĠĠĠĠĠĠĠ Ġval Ġmy Address Ġ= Ġmock < Rad ix Address >() ĊĠĠĠĠĠĠĠ Ġwhenever ( universe . getAddress From ( my Key )). thenReturn ( my Address ) ĊĠĠĠĠĠĠĠ Ġwhenever ( atom . summary ()). thenReturn ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCollections . singleton Map ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset Of ( my Key ), ĠCollections . singleton Map ( Asset . TEST . id , Ġ 0 L ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtest Observer Ġ= ĠTest Observer . create < Token Transfer >() ĊĠĠĠĠĠĠĠ Ġval Ġtoken Transfer Translator Ġ= ĠToken Transfer Translator ( universe , Ġparticle Store ) ĊĠĠĠĠĠĠĠ Ġtoken Transfer Translator . from Atom ( atom , Ġmock ()). subscribe ( test Observer ) ĊĠĠĠĠĠĠĠ Ġtest Observer . assert Value Ġ{ Ġtransfer Ġ-> Ġmy Address Ġ== Ġtransfer . from Ġ&& Ġmy Address Ġ== Ġtransfer . to Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcreate Transaction With No Funds () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġuniverse Ġ= Ġmock < Rad ix Un iverse >() ĊĠĠĠĠĠĠĠ Ġval Ġaddress Ġ= Ġmock < Rad ix Address >() ĊĊĠĠĠĠĠĠĠ Ġval Ġtransfer Translator Ġ= ĠToken Transfer Translator ( universe , Ġobject Ġ: ĠParticle Store Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġget Consum ables ( address : ĠRad ix Address ): ĠObservable < Abstract Consum able > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠObservable . never () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġval Ġtransfer Tokens Action Ġ= Ġmock < Transfer Tokens Action >() ĊĠĠĠĠĠĠĠ Ġwhenever ( transfer Tokens Action . sub Unit Amount ). thenReturn ( 1 0 L ) ĊĠĠĠĠĠĠĠ Ġwhenever ( transfer Tokens Action . from ). thenReturn ( address ) ĊĠĠĠĠĠĠĠ Ġwhenever ( transfer Tokens Action . token Class ). thenReturn ( Asset . TEST ) ĊĊĠĠĠĠĠĠĠ Ġval Ġobserver Ġ= ĠTest Observer . create < Any >() ĊĠĠĠĠĠĠĠ Ġtransfer Translator . translate ( transfer Tokens Action , ĠAtom Builder ()). subscribe ( observer ) ĊĠĠĠĠĠĠĠ Ġobserver . await Terminal Event () ĊĠĠĠĠĠĠĠ Ġobserver . assert Error ( Ins ufficient Funds Exception ( Asset . TEST , Ġ 0 , Ġ 1 0 )) ĊĠĠĠ Ġ} Ċ } Ċ