/** Ċ * ĠCopyright ĠS or am its u ĠCo ., ĠLtd . ĠAll ĠRights ĠReserved . Ċ * ĠSPDX - License - Identifier : ĠGPL - 3 . 0 Ċ */ Ċ Ċ package Ġjp . co . sor am its u . feature _ account _ impl . data . map pers Ċ Ċ import Ġcom . google . gson . Gson Ċ import Ġcom . google . gson . JsonObject Ċ import Ġjp . co . sor am its u . common . res our ses . ResourceManager Ċ import Ġjp . co . sor am its u . common . util . Numbers Formatter Ċ import Ġjp . co . sor am its u . feature _ account _ api . domain . model . Activity Feed Ċ import Ġjp . co . sor am its u . feature _ account _ impl . R Ċ import Ġjp . co . sor am its u . test _ shared . any NonNull Ċ import Ġjunit . framework . Assert . assertEquals Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . BDD Mockito . any Int Ċ import Ġorg . mockito . BDD Mockito . given Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ import Ġjava . util . Date Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠActivity Gson Converter Test Ġ{ ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġresource Manager : ĠResourceManager ĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġnumbers Formatter : ĠNumbers Formatter ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġactivity Gson Converter : ĠActivity Gson Converter ĊĊĠĠĠ Ġ@ Before Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ user _ registered _ type )). willReturn (" Friend ĠRegistered ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ user _ registered _ title _ template )). willReturn ("% s Ġ% s ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ user _ registered _ description )). willReturn (" Your Ġre putation Ġwill Ġbe Ġincreased !") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ val _ between _ users _ transfer red _ type _ template )). willReturn (" XOR ĠReceived ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ v oting _ rights _ credit ed _ type _ template )). willReturn (" Votes Ġdistribution ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ v oting _ rights _ title _ template )). willReturn (" Daily Ġvotes ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ project _ fun ded _ type _ template )). willReturn (" Project Ġhas Ġbeen Ġcompleted !") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ project _ fun ded _ title _ template )). willReturn ("% s ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ project _ fun ded _ description _ template _ val )). willReturn (" You Ġwill Ġreceive Ġinformation Ġabout ĠXOR Ġreward Ġsoon ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ project _ created _ type _ template )). willReturn (" New Ġproject !") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ project _ created _ title _ template )). willReturn ("% s ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ project _ created _ description _ template )). willReturn ("% s ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ project _ closed _ type _ template )). willReturn (" Project Ġreached Ġdeadline !") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ project _ closed _ title _ template )). willReturn ("% s ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ val _ reward _ credit ed _ from _ project _ type _ template )). willReturn (" XOR ĠRew ard Ġfor Ġvoting ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ v oted _ friend _ added _ type _ template )). willReturn (" Friend Ġv oted Ġfor Ġproject ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ v oted _ friend _ added _ title _ template )). willReturn ("% s Ġ% s ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ v oted _ friend _ added _ description _ template )). willReturn ("% s Ġhas Ġspent Ġ% s Ġvotes Ġfor Ġ% s Ġproject ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ user _ rank _ changed _ type _ template )). willReturn (" Rank Ġchanged ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ user _ rank _ changed _ title _ template )). willReturn (" Your Ġrank Ġnow Ġis Ġ% s Ġ( of Ġ% s )) ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ project )). willReturn (" Project ") ĊĠĠĠĠĠĠĠ Ġgiven ( resource Manager . getString ( R . string . activity _ user )). willReturn (" User ") ĊĊĠĠĠĠĠĠĠ Ġactivity Gson Converter Ġ= ĠActivity Gson Converter ( resource Manager , Ġnumbers Formatter ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test Ġfun Ġ` convert Ġactivity Ġitems Ġcalled `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgson Ġ= ĠGson () ĊĠĠĠĠĠĠĠ Ġval Ġproject Json Ġ= Ġgson . fromJson ("{ \" 8 7 6 7 0 6 6 1 - 0 ff 5 - 4 9 6 6 - 9 6 a 5 - 9 9 ec 7 0 7 1 0 4 1 9 \":{\" projectName \":\" Ar st ot z ka \" }, \" 3 b 2 f 4 7 0 1 - 5 e 7 2 - 4 6 4 d - 9 cfe - 7 b fff 1 a eed 7 4 \":{\" projectName \":\" Name \" }} ", ĠJsonObject :: class . java ) ĊĠĠĠĠĠĠĠ Ġval Ġusers Json Ġ= Ġgson . fromJson ("{ \" did : sor a : 4 5 8 0 2 d 5 bd 1 5 8 8 7 8 b 2 9 2 c \":{\" firstName \":\" I van \",\" lastName \":\" I van ov \" }} ", ĠJsonObject :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevents Json List Ġ= Ġmutable ListOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgson . fromJson ("{ \" iss ued By \":\" \",\" iss ued At \": 0 ,\" type \":\" V oting Rights Credit ed \",\" userId \":\" did : sor a : 4 5 8 0 2 d 5 bd 1 5 8 8 7 8 b 2 9 2 c \",\" v oting Rights \":\" 3 . 9 4 7 2 7 5 3 3 7 4 2 2 5 \" }", ĠJsonObject :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgson . fromJson ("{ \" iss ued At \": 0 ,\" type \":\" Friend Registered \",\" userId \":\" did : sor a : 4 5 8 0 2 d 5 bd 1 5 8 8 7 8 b 2 9 2 c \" }", ĠJsonObject :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgson . fromJson ("{ \" iss ued At \": 0 ,\" type \":\" XOR Between Users Transfer red \",\" receiver \":\" did : sor a : 4 5 8 0 2 d 5 bd 1 5 8 8 7 8 b 2 9 2 c \",\" sender \":\" did : sor a : 4 5 8 0 2 d 5 bd 1 5 8 8 7 8 b 2 9 2 c \",\" amount \": 1 0 }", ĠJsonObject :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgson . fromJson ("{ \" iss ued By \":\" \",\" iss ued At \": 0 ,\" type \":\" User Rank Changed \",\" userId \":\" did : sor a : 4 5 8 0 2 d 5 bd 1 5 8 8 7 8 b 2 9 2 c \",\" rank \": 2 9 ,\" total Rank \": 3 5 }", ĠJsonObject :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgson . fromJson ("{ \" iss ued By \":\" \",\" iss ued At \": 0 ,\" type \":\" Project Created \",\" projectId \":\" 3 b 2 f 4 7 0 1 - 5 e 7 2 - 4 6 4 d - 9 cfe - 7 b fff 1 a eed 7 4 \",\" name \":\" Name \",\" description \":\" Short Ġdescription \",\" detailed Description \":\" Detailed Ġdescription \",\" project Link \":\" http :// www . bbc . com \",\" image Link \":\" https :// sor a - projects - static - dev . s 3 . amazonaws . com / b 4 ae 2 4 5 8 3 3 2 3 7 8 4 1 9 f 8 1 3 2 f 9 abb 6 9 e 7 c 1 4 c 6 2 a 7 2 ee 1 9 1 cc 3 6 d 8 6 ae 1 4 6 4 d 4 6 2 2 d \",\" fund ing Target \":\" 1 0 0 0 \",\" fund ing Deadline \": 1 5 7 7 5 3 3 6 7 9 ,\" email \":\" test @ mail . com \",\" wallet AccountId \":\" no ir @ sor a \" }", ĠJsonObject :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgson . fromJson ("{ \" iss ued At \": 0 ,\" type \":\" Project F unded \",\" projectId \":\" 8 7 6 7 0 6 6 1 - 0 ff 5 - 4 9 6 6 - 9 6 a 5 - 9 9 ec 7 0 7 1 0 4 1 9 \" }", ĠJsonObject :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgson . fromJson ("{ \" iss ued At \": 0 ,\" type \":\" Project Closed \",\" projectId \":\" 8 7 6 7 0 6 6 1 - 0 ff 5 - 4 9 6 6 - 9 6 a 5 - 9 9 ec 7 0 7 1 0 4 1 9 \" }", ĠJsonObject :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgson . fromJson ("{ \" iss ued At \": 0 ,\" type \":\" XOR Reward Credit ed From Project \",\" projectId \":\" 8 7 6 7 0 6 6 1 - 0 ff 5 - 4 9 6 6 - 9 6 a 5 - 9 9 ec 7 0 7 1 0 4 1 9 \",\" reward \": 5 5 0 ,\" userId \":\" did : sor a : 4 5 8 0 2 d 5 bd 1 5 8 8 7 8 b 2 9 2 c \" }", ĠJsonObject :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgson . fromJson ("{ \" iss ued At \": 0 ,\" type \":\" User V oted For Project \",\" projectId \":\" 8 7 6 7 0 6 6 1 - 0 ff 5 - 4 9 6 6 - 9 6 a 5 - 9 9 ec 7 0 7 1 0 4 1 9 \",\" given Votes \": 1 0 0 ,\" potential Rew ar \": 1 0 0 ,\" userId \":\" did : sor a : 4 5 8 0 2 d 5 bd 1 5 8 8 7 8 b 2 9 2 c \" }", ĠJsonObject :: class . java ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġactivities Ġ= Ġmutable ListOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Feed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Votes Ġdistribution ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Daily Ġvotes ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" 1 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate ( 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . icon _ activity _ vote , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . heart _ shape ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Feed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Friend ĠRegistered ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" I van ĠI van ov ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Your Ġre putation Ġwill Ġbe Ġincreased !", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate ( 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . icon _ activity _ invite , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Feed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" XOR ĠReceived ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" I van ĠI van ov ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" 1 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate ( 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . icon _ activity _ xor , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Feed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Rank Ġchanged ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Your Ġrank Ġnow Ġis Ġ 2 9 Ġ( of Ġ 3 5 )) ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate ( 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . icon _ activity _ re putation , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Feed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" New Ġproject !", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Name ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Short Ġdescription ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate ( 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . icon _ activity _ project , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Feed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Project Ġhas Ġbeen Ġcompleted !", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Ar st ot z ka ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" You Ġwill Ġreceive Ġinformation Ġabout ĠXOR Ġreward Ġsoon ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate ( 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . icon _ activity _ project , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Feed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Project Ġreached Ġdeadline !", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Ar st ot z ka ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate ( 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . icon _ activity _ project , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Feed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" XOR ĠRew ard Ġfor Ġvoting ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Ar st ot z ka ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" 1 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate ( 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . icon _ activity _ xor , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Feed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Friend Ġv oted Ġfor Ġproject ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" I van ĠI van ov ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" I van Ġhas Ġspent Ġ 1 Ġvotes Ġfor ĠAr st ot z ka Ġproject ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠDate ( 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠR . drawable . icon _ activity _ vote , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġgiven ( numbers Formatter . format Integer ( any NonNull ())). willReturn (" 1 ") ĊĠĠĠĠĠĠĠ Ġgiven ( numbers Formatter . format BigDecimal ( any NonNull (), Ġany Int ())). willReturn (" 1 ") ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( activities , Ġactivity Gson Converter . convert Activity Items ( events Json List , Ġproject Json , Ġusers Json , Ġ" did : sor a : 4 5 8 0 2 d 5 bd 1 5 8 8 7 8 b 2 9 2 c ")) ĊĠĠĠ Ġ} Ċ }