@Test
public void startRequest_ShouldSendBroadcastWithExpectedParameters() throws Exception {

    when(ctx.getPackageManager()).thenReturn(pm);
    when(pm.getApplicationInfo(anyString(), anyInt())).thenReturn(appInfo);
    target.listener(listener);
    target.startRequest(ctx, "rationale");
    verify(ctx).registerReceiver((BroadcastReceiver) notNull(), filterCaptor.capture());
    verify(ctx).sendBroadcast(intentCaptor.capture());
    Intent request = intentCaptor.getValue();
    assertThat(request.getComponent().getPackageName(), is(Nanny.SERVER_APP_ID));
    assertThat(request.getStringExtra(Nanny.CLIENT_ADDRESS), is(filterCaptor.getValue().getAction(0)));
    assertThat(request.hasExtra(Nanny.PROTOCOL_VERSION), is(true));
    Bundle entity = request.getBundleExtra(Nanny.ENTITY_BODY);
    assertThat(entity.containsKey(Nanny.SENDER_IDENTITY), is(true));
    assertThat(entity.containsKey(Nanny.REQUEST_PARAMS), is(true));
    assertThat(entity.containsKey(Nanny.REQUEST_RATIONALE), is(true));
}