### Question:
TitleBuilder extends UpdateBuilder { public String buildCondensed() { String title = ""; if(validNotificationsResponse() && validInboxResponse()) { title = resources.getString(R.string.message_condensed, inboxResponse.count); title += " "; title += resources.getString(R.string.updates_condensed, notificationResponse.count); } else if(validNotificationsResponse()) { title = resources.getString(R.string.updates_condensed, notificationResponse.count); } else if(validInboxResponse()) { title = resources.getString(R.string.message_condensed, inboxResponse.count); } return title; } TitleBuilder(NotificationsResponse notificationsResponse, InboxResponse inboxResponse, Resources resources); String buildCondensed(); String build();  }### Answer:
@Test public void should_build_mail_0_updates_0() { String title = "Mail: 0 Updates: 0"; InboxResponse inboxResponse = createInboxResponse(0); NotificationsResponse notificationsResponse = createNotificationResponse(0); TitleBuilder titleBuilder = new TitleBuilder(notificationsResponse, inboxResponse, resources); assertEquals(title, titleBuilder.buildCondensed()); }
@Test public void should_build_mail_2_updates_16() { int messageCount = 2; int notificationCount = 16; String title = resources.getString(R.string.message_condensed, messageCount); title += " "; title += resources.getString(R.string.updates_condensed, notificationCount); TitleBuilder titleBuilder = new TitleBuilder(createNotificationResponse(16), createInboxResponse(2), resources); assertEquals(title, titleBuilder.buildCondensed()); }
@Test public void should_build_mail_2() { int messageCount = 2; String title = resources.getString(R.string.message_condensed, messageCount); TitleBuilder titleBuilder = new TitleBuilder(null, createInboxResponse(2), resources); assertEquals(title, titleBuilder.buildCondensed()); titleBuilder = new TitleBuilder(createInvalidNotificationResponse(), createInboxResponse(2), resources); assertEquals(title, titleBuilder.buildCondensed()); }
@Test public void should_build_updates_16() { int notificationCount = 16; String title = resources.getString(R.string.updates_condensed, notificationCount); TitleBuilder titleBuilder = new TitleBuilder(createNotificationResponse(16), null, resources); assertEquals(title, titleBuilder.buildCondensed()); titleBuilder = new TitleBuilder(createNotificationResponse(16), createInvalidInboxResponse(), resources); assertEquals(title, titleBuilder.buildCondensed()); }