@Test public void shouldDisconnectXMPPOnDestroy() { startService(); xmppService.onDestroy(); assertFalse(xmppConnection.isConnected()); }
@Test public void shouldUnregisterInterestInNetworkChangesOnDestroy() { startService(); xmppService.onDestroy(); List<ShadowApplication.Wrapper> wrappers = Robolectric.getShadowApplication().getRegisteredReceivers(); Assert.assertEquals(0, wrappers.size()); }
private void startService() { Intent intent = new Intent(xmppService.getString(R.string.start_xmpp_service)); xmppService.onStartCommand(intent, 0, 0); }
private void sendXmppMessageViaIntent(String message) { Intent intent = new Intent(xmppService.getString(R.string.send_xmpp)); intent.putExtra(xmppService.getString(R.string.send_xmpp_extra), message); xmppService.onStartCommand(intent, 0, 0); }
@Before public void setup() { xmppService.onCreate(); xmppConnection = xmppConnectionProvider.get(); getShadowChatManager().clearAllChats(); }