GpsStatusEvent implements Event { @Override public void process(Context context, Intent intent) { mAck.sendAck(context, intent); Bundle entity = new NannyBundle(intent).getEntityBody(); if (entity == null) { Timber.wtf(Err.NO_ENTITY); return; } int event = entity.getInt(EVENT, -1); mListener.onGpsStatusChanged(event); } GpsStatusEvent(GpsStatus.Listener listener); @VisibleForTesting  GpsStatusEvent(GpsStatus.Listener listener, Ack ack); @Override String filter(); @Override void process(Context context, Intent intent); @PPP static final String EVENT; }
@Test public void process() throws Exception { mBundle.putInt(GpsStatusEvent.EVENT, 123); mIntent.putExtra(Nanny.ENTITY_BODY, mBundle); mRoute.process(mContext, mIntent); verify(mAck).sendAck(mContext, mIntent); verify(mListener).onGpsStatusChanged(123); }