@Test public void should_build_2_messages() { int messageCount = 2; String title = resources.getQuantityString(R.plurals.message, messageCount, messageCount); TitleBuilder titleBuilder = new TitleBuilder(null, createInboxResponse(2), resources); assertEquals(title, titleBuilder.build()); titleBuilder = new TitleBuilder(createInvalidNotificationResponse(), createInboxResponse(2), 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();  }