package Ġio . m verse . k slack Ċ Ċ import Ġio . m verse . k slack . api . methods . request . user groups . User groups CreateRequest Ċ import Ġio . m verse . k slack . api . methods . request . user groups . User groups List Request Ċ import Ġio . m verse . k slack . api . methods . request . user groups . users . User group Users List Request Ċ import Ġorg . hamcrest . Core Matchers .` is ` Ċ import Ġorg . hamcrest . Core Matchers . any Of Ċ import Ġorg . hamcrest . Core Matchers . equalTo Ċ import Ġorg . junit . Assert . assertThat Ċ import Ġorg . junit . Test Ċ Ċ class ĠSlack _ user groups _ Test Ġ{ ĊĊĠ Ġinternal Ġvar Ġslack Ġ= Ġio . m verse . k slack . Slack () ĊĠ Ġinternal Ġvar Ġtoken Ġ= ĠSystem . getenv ( Constants . SL ACK _ TEST _ O AUTH _ ACCESS _ TOKEN ) ĊĊĠ Ġ@ Test ĊĠ Ġ@ Throws ( Exception :: class ) ĊĠ Ġfun Ġcreate () Ġ{ ĊĠĠĠ Ġval Ġresponse Ġ= Ġslack . user groups Create ( User groups CreateRequest ( ĊĠĠĠĠĠĠĠ Ġtoken Ġ= Ġtoken , ĊĠĠĠĠĠĠĠ Ġname Ġ= Ġ" user group -" Ġ+ ĠSystem . currentTimeMillis () ĊĠĠĠ Ġ)) ĊĠĠĠ ĠassertThat ( response . ok , Ġ` is `( false )) ĊĠĠĠ ĠassertThat < String >( response . error , Ġ` is `( any Of ( ĊĠĠĠĠĠĠĠ Ġ// ĠFor Ġa Ġgood Ġold Ġtoken , Ġ" paid _ teams _ only " Ġcan Ġbe Ġreturned Ġas Ġthe Ġerror ĊĠĠĠĠĠĠĠ ĠequalTo (" paid _ teams _ only "), ĊĠĠĠĠĠĠĠ Ġ// ĠAs Ġof Ġ 2 0 1 8 , Ġthis Ġcode Ġis Ġgenerally Ġreturned Ġfor Ġnewly Ġcreated Ġtoken ĊĠĠĠĠĠĠĠ ĠequalTo (" missing _ scope ") ĊĠĠĠ Ġ))) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġ@ Throws ( Exception :: class ) ĊĠ Ġfun Ġlist () Ġ{ ĊĠĠĠ Ġval Ġresponse Ġ= Ġslack . user groups List ( User groups List Request ( token )) ĊĠĠĠ ĠassertThat ( response . ok , Ġ` is `( true )) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġ@ Throws ( Exception :: class ) ĊĠ Ġfun Ġusers () Ġ{ ĊĠĠĠ Ġval Ġuser groups Ġ= Ġslack . user groups List ( User groups List Request ( token )) ĊĠĠĠ Ġif Ġ( user groups . ok Ġ&& Ġuser groups . user groups !!. size Ġ> Ġ 0 ) Ġ{ ĊĠĠĠĠĠ Ġval Ġresponse Ġ= Ġslack . user group Users List ( ĊĠĠĠĠĠĠĠĠĠ ĠUser group Users List Request ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtoken Ġ= Ġtoken , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġis Include Disabled Ġ= Ġfalse , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġuser group Ġ= Ġuser groups . user groups ! ![ 0 ]. id ĊĠĠĠĠĠĠĠĠĠ Ġ)) ĊĠĠĠĠĠ ĠassertThat ( response . ok , Ġ` is `( false )) ĊĠĠĠĠĠ Ġ// ĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( response . getError (), Ġis (" missing _ required _ argument ")); ĊĠĠĠĠĠ Ġ// ĠAs Ġof Ġ 2 0 1 8 / 0 5 , Ġthe Ġerror Ġmessage Ġhas Ġbeen Ġchanged ĊĠĠĠĠĠ ĠassertThat < String >( response . error , Ġ` is ` (" no _ such _ sub team ")) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġ@ Throws ( Exception :: class ) ĊĠ Ġfun Ġusers _ failure () Ġ{ ĊĠĠĠ Ġval Ġresponse Ġ= Ġslack . user group Users List ( ĊĠĠĠĠĠĠĠ ĠUser group Users List Request ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtoken Ġ= Ġtoken , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis Include Disabled Ġ= Ġfalse , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġuser group Ġ= Ġ" dummy " ĊĠĠĠĠĠĠĠ Ġ)) ĊĠĠĠ ĠassertThat ( response . ok , Ġ` is `( false )) ĊĠĠĠ Ġ// ĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( response . getError (), Ġis (" missing _ required _ argument ")); ĊĠĠĠ Ġ// ĠAs Ġof Ġ 2 0 1 8 / 0 5 , Ġthe Ġerror Ġmessage Ġhas Ġbeen Ġchanged ĊĠĠĠ ĠassertThat < String >( response . error , Ġ` is ` (" no _ such _ sub team ")) ĊĠ Ġ} Ċ }