Ack { public void sendAck(Context context, Intent response) { NannyBundle bundle = new NannyBundle(response); String ackAddr = bundle.getAckAddress(); if (TextUtils.isEmpty(ackAddr)) { Timber.wtf(Err.NO_ACK_ADDR, ackAddr); return; } String clientAddr = response.getAction(); Intent ackIntent = new Intent(ackAddr) .putExtra(Nanny.PROTOCOL_VERSION, Nanny.PPP_0_1) .putExtra(Nanny.CLIENT_ADDRESS, clientAddr); context.sendBroadcast(ackIntent); }  void sendAck(Context context, Intent response);  }
@Test public void sendAck() throws Exception { mIntent.setAction("clientAddr") .putExtras(mBuilder.ackAddress("ackAddr").build()); mAck.sendAck(mContext, mIntent); verify(mContext).sendBroadcast(mIntentCaptor.capture()); assertThat(mIntentCaptor.getValue().getAction(), is("ackAddr")); assertThat(mIntentCaptor.getValue().getStringExtra(Nanny.PROTOCOL_VERSION), is(Nanny.PPP_0_1)); assertThat(mIntentCaptor.getValue().getStringExtra(Nanny.CLIENT_ADDRESS), is("clientAddr")); }