package Ġnet . free feed . k cab end . model Ċ Ċ import Ġorg . junit . Ignore Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . Assert . assertEquals Ċ Ċ public Ġclass ĠDirect s Test Ġ: ĠAbstract Model Test () Ġ{ ĊĠĠĠ ĠTest Ġpublic Ġfun Ġusers Can Send Direct s () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġ( user 1 , Ġuser 2 , Ġuser 3 ) Ġ= Ġcreate Users (" Alpha ", Ġ" Beta ", Ġ" Gamma ") ĊĠĠĠĠĠĠĠ Ġuser 1 . subscribe To ( user 2 ) ĊĠĠĠĠĠĠĠ Ġuser 2 . subscribe To ( user 1 ) ĊĠĠĠĠĠĠĠ Ġuser 3 . subscribe To ( user 1 ) ĊĊĠĠĠĠĠĠĠ Ġuser 1 . publish Post (" Hello ĠBeta ", Ġint ArrayOf ( user 2 . id )) ĊĊĠĠĠĠĠĠĠ Ġuser 1 . verify Home Posts (" Hello ĠBeta ") ĊĠĠĠĠĠĠĠ Ġuser 2 . verify Home Posts (" Hello ĠBeta ") ĊĠĠĠĠĠĠĠ Ġuser 3 . verify Home Posts () ĊĠĠĠ Ġ} ĊĊĠĠĠ ĠTest Ġpublic Ġfun Ġdirect s Dont Ap pear In Own Posts For Other User () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġ( user 1 , Ġuser 2 , Ġuser 3 ) Ġ= Ġcreate Users (" Alpha ", Ġ" Beta ", Ġ" Gamma ") ĊĠĠĠĠĠĠĠ Ġuser 1 . subscribe To ( user 2 ) ĊĠĠĠĠĠĠĠ Ġuser 2 . subscribe To ( user 1 ) ĊĊĠĠĠĠĠĠĠ Ġuser 1 . publish Post (" Hello ĠBeta ", Ġint ArrayOf ( user 2 . id )) ĊĊĠĠĠĠĠĠĠ Ġval Ġalpha Posts Seen By Gamma Ġ= Ġuser 1 . own Posts . get Posts ( user 3 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 0 , Ġalpha Posts Seen By Gamma . size ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ ĠTest ( expected Ġ= ĠFor bidden Exception :: class ) Ġpublic Ġfun Ġcant Send Post To Self And Other User () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġ( user 1 , Ġuser 2 ) Ġ= Ġcreate Users (" Alpha ", Ġ" Beta ") ĊĠĠĠĠĠĠĠ Ġuser 1 . subscribe To ( user 2 ) ĊĠĠĠĠĠĠĠ Ġuser 2 . subscribe To ( user 1 ) ĊĊĠĠĠĠĠĠĠ Ġuser 1 . publish Post (" Hello ĠBeta ", Ġint ArrayOf ( user 1 . id , Ġuser 2 . id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ ĠTest ( expected Ġ= ĠFor bidden Exception :: class ) Ġpublic Ġfun Ġcant Send Direct sTo Non Mut ual Sub scribers () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġ( user 1 , Ġuser 2 ) Ġ= Ġcreate Users (" Alpha ", Ġ" Beta ") ĊĠĠĠĠĠĠĠ Ġuser 1 . publish Post (" Hello ĠBeta ", Ġint ArrayOf ( user 2 . id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ ĠTest Ġpublic Ġfun Ġcan See Direct Messages Only () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġ( user 1 , Ġuser 2 ) Ġ= Ġcreate Users (" Alpha ", Ġ" Beta ", Ġ" Gamma ") ĊĠĠĠĠĠĠĠ Ġuser 1 . subscribe To ( user 2 ) ĊĠĠĠĠĠĠĠ Ġuser 2 . subscribe To ( user 1 ) ĊĊĠĠĠĠĠĠĠ Ġuser 1 . publish Post (" Hello ĠEvery one ") ĊĠĠĠĠĠĠĠ Ġuser 1 . publish Post (" Hello ĠBeta ", Ġint ArrayOf ( user 2 . id )) ĊĊĠĠĠĠĠĠĠ Ġval Ġdirect s Ġ= Ġuser 1 . direct Messages Timeline . get Posts ( user 1 ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġdirect s . size ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠTODO ĠCan Ġa Ġrecipient Ġof Ġa Ġdirect Ġmessage Ġdelete Ġit ? Ċ } Ċ