@Test public void should_build_0_messages_0_notifications() { String title = "0 Messages / 0 Notifications"; InboxResponse inboxResponse = createInboxResponse(0); NotificationsResponse notificationsResponse = createNotificationResponse(0); TitleBuilder titleBuilder = new TitleBuilder(notificationsResponse, inboxResponse, resources); assertEquals(title, titleBuilder.build()); }
public String build() { String title = ""; if(validNotificationsResponse() && validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); title += " / "; title += resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validNotificationsResponse()) { title = resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); } return title; }
TitleBuilder extends UpdateBuilder { public String build() { String title = ""; if(validNotificationsResponse() && validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); title += " / "; title += resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validNotificationsResponse()) { title = resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); } return title; } }
TitleBuilder extends UpdateBuilder { public String build() { String title = ""; if(validNotificationsResponse() && validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); title += " / "; title += resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validNotificationsResponse()) { title = resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); } return title; } TitleBuilder(NotificationsResponse notificationsResponse, InboxResponse inboxResponse, Resources resources); }
TitleBuilder extends UpdateBuilder { public String build() { String title = ""; if(validNotificationsResponse() && validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); title += " / "; title += resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validNotificationsResponse()) { title = resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); } return title; } TitleBuilder(NotificationsResponse notificationsResponse, InboxResponse inboxResponse, Resources resources); String buildCondensed(); String build(); }
TitleBuilder extends UpdateBuilder { public String build() { String title = ""; if(validNotificationsResponse() && validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); title += " / "; title += resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validNotificationsResponse()) { title = resources.getQuantityString(R.plurals.notification, notificationResponse.count, notificationResponse.count); } else if(validInboxResponse()) { title = resources.getQuantityString(R.plurals.message, inboxResponse.count, inboxResponse.count); } return title; } TitleBuilder(NotificationsResponse notificationsResponse, InboxResponse inboxResponse, Resources resources); String buildCondensed(); String build();  }