### Question:
XmppRosterListener implements RosterListener { @Override public void presenceChanged(@Nonnull final Presence presence) { final String accountUserId = presence.getFrom(); final User contact = getUserService().getUserById(account.newUserEntity(accountUserId)); final boolean online = presence.isAvailable(); logUserPresence("XmppRosterListener", account, online, contact.getLogin()); getUserService().onContactPresenceChanged(account.getUser(), contact, online); } XmppRosterListener(@Nonnull XmppAccount account); @Override void entriesAdded(@Nonnull Collection<String> contactIds); @Override void entriesUpdated(@Nonnull Collection<String> contactIds); @Override void entriesDeleted(@Nonnull Collection<String> contactIds); @Override void presenceChanged(@Nonnull final Presence presence);  }### Answer:
@Test public void testShouldCallUserServiceOnPresenceChange() throws Exception { final XmppRosterListener l = new XmppRosterListener(getXmppAccount()); final Presence presence = new Presence(Presence.Type.available, "test", 0, Presence.Mode.available); presence.setFrom("test"); l.presenceChanged(presence); }