-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for the method findUserByEmail
- Loading branch information
1 parent
9705580
commit 120dc76
Showing
1 changed file
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,15 +29,14 @@ public void connect() | |
channels.put("channelid4",new SlackChannel("channelid4", "testchannel4", "topicchannel4", "topicchannel4", false, false, false)); | ||
channels.put("channelid5",new SlackChannel("channelid5", "testchannel5", "topicchannel5", "topicchannel5", false, false, false)); | ||
|
||
users.put("userid1",SlackPersonaImpl.builder().id("userid1").userName("username1").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("userid2",SlackPersonaImpl.builder().id("userid2").userName("username2").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("userid3",SlackPersonaImpl.builder().id("userid3").userName("username3").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("userid4",SlackPersonaImpl.builder().id("userid4").userName("username4").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("userid5",SlackPersonaImpl.builder().id("userid5").userName("username5").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("userid1",SlackPersonaImpl.builder().id("userid1").userName("username1").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").email("[email protected]").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("userid2",SlackPersonaImpl.builder().id("userid2").userName("username2").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").email("[email protected]").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("userid3",SlackPersonaImpl.builder().id("userid3").userName("username3").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").email("[email protected]").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("userid4",SlackPersonaImpl.builder().id("userid4").userName("username4").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").email("[email protected]").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("userid5",SlackPersonaImpl.builder().id("userid5").userName("username5").profile(SlackProfileImpl.builder().presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").email("[email protected]").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("botid1",SlackPersonaImpl.builder().bot(true).id("botid1").userName("botname1").profile(SlackProfileImpl.builder().realName("real bot name 1").presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("botid2",SlackPersonaImpl.builder().bot(true).id("botid2").userName("botname2").profile(SlackProfileImpl.builder().realName("real bot name 2").presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
users.put("botid3",SlackPersonaImpl.builder().bot(true).id("botid3").userName("botname3").profile(SlackProfileImpl.builder().realName("real bot name 3").presence(SlackPresence.ACTIVE).skype("testSkype").phone("testPhone").title("testTitle").build()).timeZone("tz").timeZoneLabel("txLabel").build()); | ||
|
||
} | ||
|
||
@Override | ||
|
@@ -278,7 +277,7 @@ public SlackMessageHandle<EmojiSlackReply> listEmoji() { | |
public void refetchUsers() {} | ||
|
||
@Override | ||
public SlackMessageHandle inviteUser(String email, String firstName, boolean setActive) | ||
public SlackMessageHandle inviteUser(String email, String firstName, boolean setActive) | ||
{ | ||
return null; | ||
} | ||
|
@@ -497,6 +496,33 @@ public void testFindUserByUserName_MissingBot() | |
assertThat(slackSession.findUserByUserName("unknownuser")).isNull(); | ||
} | ||
|
||
@Test | ||
public void testFindUserByEmail_ExistingBot() | ||
{ | ||
TestSlackSessionImpl slackSession = new TestSlackSessionImpl(); | ||
|
||
// case-sensitive | ||
slackSession.connect(); | ||
SlackUser slackUser = slackSession.findUserByEmail("[email protected]"); | ||
assertThat(slackUser).isNotNull(); | ||
assertThat(slackUser.getId()).isEqualTo("userid1"); | ||
|
||
// case-insensitive | ||
slackUser = slackSession.findUserByEmail("[email protected]"); | ||
assertThat(slackUser).isNotNull(); | ||
assertThat(slackUser.getId()).isEqualTo("userid1"); | ||
} | ||
|
||
@Test | ||
public void testFindUserByEmail_MissingBot() | ||
{ | ||
TestSlackSessionImpl slackSession = new TestSlackSessionImpl(); | ||
|
||
slackSession.connect(); | ||
|
||
assertThat(slackSession.findUserByEmail("[email protected]")).isNull(); | ||
} | ||
|
||
@Test | ||
public void testAddConnectedListener() { | ||
SlackConnectedListener listener = new SlackConnectedListener() { | ||
|