NmeaEvent 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; } long timestamp = entity.getLong(TIMESTAMP, -1); String nmea = entity.getString(NMEA); mListener.onNmeaReceived(timestamp, nmea); } NmeaEvent(NmeaListener listener); @VisibleForTesting  NmeaEvent(NmeaListener listener, Ack ack); @Override String filter(); @Override void process(Context context, Intent intent); @PPP static final String TIMESTAMP; @PPP static final String NMEA; }
@Test public void process() throws Exception { mBundle.putLong(NmeaEvent.TIMESTAMP, 123); mBundle.putString(NmeaEvent.NMEA, "nmea"); mIntent.putExtra(Nanny.ENTITY_BODY, mBundle); mRoute.process(mContext, mIntent); verify(mNmeaListener).onNmeaReceived(123, "nmea"); }