@Test public void testBuildNotification() { mNotification.parseMessageData(); Notification notification = mNotification.buildNotification(mContext, null); assertNotNull(notification); StoredNotification stored = mNotification.getStoredNotification(); assertNotNull(stored); assertEquals(stored.getType(), NotificationTypes.DISTRICT_POINTS_UPDATED); assertEquals(stored.getTitle(), mContext.getString(R.string.notification_district_points_title, "PNW")); assertEquals(stored.getBody(), mContext.getString(R.string.notification_district_points_updated, "Pacific Northwest")); assertEquals(stored.getMessageData(), mData.toString()); assertEquals(stored.getIntent(), MyTBAHelper.serializeIntent(mNotification.getIntent(mContext))); assertNotNull(stored.getTime()); }
@Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String contentText = r.getString(R.string.notification_district_points_updated, districtName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String districtCode = EventHelper.getEventCode(districtKey); String title = r.getString(R.string.notification_district_points_title, districtCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); }
DistrictPointsUpdatedNotification extends BaseNotification<GenericNotificationViewModel> { @Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String contentText = r.getString(R.string.notification_district_points_updated, districtName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String districtCode = EventHelper.getEventCode(districtKey); String title = r.getString(R.string.notification_district_points_title, districtCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); } }
DistrictPointsUpdatedNotification extends BaseNotification<GenericNotificationViewModel> { @Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String contentText = r.getString(R.string.notification_district_points_updated, districtName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String districtCode = EventHelper.getEventCode(districtKey); String title = r.getString(R.string.notification_district_points_title, districtCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); } DistrictPointsUpdatedNotification(String messageData); }
DistrictPointsUpdatedNotification extends BaseNotification<GenericNotificationViewModel> { @Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String contentText = r.getString(R.string.notification_district_points_updated, districtName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String districtCode = EventHelper.getEventCode(districtKey); String title = r.getString(R.string.notification_district_points_title, districtCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); } DistrictPointsUpdatedNotification(String messageData); @Override void parseMessageData(); String getDistrictName(); String getDistrictKey(); @Override Notification buildNotification(Context context, FollowsChecker followsChecker); @Override Intent getIntent(Context c); @Override void updateDataLocally(); @Override int getNotificationId(); @Nullable @Override GenericNotificationViewModel renderToViewModel(Context context, @Nullable Void aVoid); }
DistrictPointsUpdatedNotification extends BaseNotification<GenericNotificationViewModel> { @Override public Notification buildNotification(Context context, FollowsChecker followsChecker) { Resources r = context.getResources(); String contentText = r.getString(R.string.notification_district_points_updated, districtName); Intent instance = getIntent(context); stored = new StoredNotification(); stored.setType(getNotificationType()); String districtCode = EventHelper.getEventCode(districtKey); String title = r.getString(R.string.notification_district_points_title, districtCode); stored.setTitle(title); stored.setBody(contentText); stored.setMessageData(messageData); stored.setIntent(MyTBAHelper.serializeIntent(instance)); stored.setTime(Calendar.getInstance().getTime()); stored.setSystemId(getNotificationId()); NotificationCompat.Builder builder = getBaseBuilder(context, instance) .setContentTitle(title) .setContentText(contentText); NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle().bigText(contentText); builder.setStyle(style); return builder.build(); } DistrictPointsUpdatedNotification(String messageData); @Override void parseMessageData(); String getDistrictName(); String getDistrictKey(); @Override Notification buildNotification(Context context, FollowsChecker followsChecker); @Override Intent getIntent(Context c); @Override void updateDataLocally(); @Override int getNotificationId(); @Nullable @Override GenericNotificationViewModel renderToViewModel(Context context, @Nullable Void aVoid);  }