@Test public void should_build_chris_message() { String body = "Chris Akins: Have you been flying solo for like 4 days? What in the world have you done with yourself? That sounds pretty sweet."; NotificationsResponse notificationsResponse = createNotificationResponseWithNotification(1397703661); InboxResponse inboxResponse = createInboxWithMessage(1397703662); BodyBuilder builder = new BodyBuilder(notificationsResponse, inboxResponse); assertEquals(body, builder.build()); builder = new BodyBuilder(createInvalidNotificationResponse(), inboxResponse); assertEquals(body, builder.build()); builder = new BodyBuilder(null, inboxResponse); assertEquals(body, builder.build()); }
public String build() { String body = ""; if(validNotificationsResponse() && validInboxResponse() && notificationResponse.count > 0 && inboxResponse.count > 0) { Date notificationDate = notificationResponse.getNotificationDate(); Date messageDate = inboxResponse.time; body = notificationDate.getTime() > messageDate.getTime() ? notificationResponse.getNotificationText() : inboxResponse.getText(); } else if(validNotificationsResponse() && notificationResponse.count > 0) { body = notificationResponse.getNotificationText(); } else if(validInboxResponse()) { body = inboxResponse.getText(); } return body; }
BodyBuilder extends UpdateBuilder { public String build() { String body = ""; if(validNotificationsResponse() && validInboxResponse() && notificationResponse.count > 0 && inboxResponse.count > 0) { Date notificationDate = notificationResponse.getNotificationDate(); Date messageDate = inboxResponse.time; body = notificationDate.getTime() > messageDate.getTime() ? notificationResponse.getNotificationText() : inboxResponse.getText(); } else if(validNotificationsResponse() && notificationResponse.count > 0) { body = notificationResponse.getNotificationText(); } else if(validInboxResponse()) { body = inboxResponse.getText(); } return body; } }
BodyBuilder extends UpdateBuilder { public String build() { String body = ""; if(validNotificationsResponse() && validInboxResponse() && notificationResponse.count > 0 && inboxResponse.count > 0) { Date notificationDate = notificationResponse.getNotificationDate(); Date messageDate = inboxResponse.time; body = notificationDate.getTime() > messageDate.getTime() ? notificationResponse.getNotificationText() : inboxResponse.getText(); } else if(validNotificationsResponse() && notificationResponse.count > 0) { body = notificationResponse.getNotificationText(); } else if(validInboxResponse()) { body = inboxResponse.getText(); } return body; } BodyBuilder(NotificationsResponse notificationsResponse, InboxResponse inboxResponse); }
BodyBuilder extends UpdateBuilder { public String build() { String body = ""; if(validNotificationsResponse() && validInboxResponse() && notificationResponse.count > 0 && inboxResponse.count > 0) { Date notificationDate = notificationResponse.getNotificationDate(); Date messageDate = inboxResponse.time; body = notificationDate.getTime() > messageDate.getTime() ? notificationResponse.getNotificationText() : inboxResponse.getText(); } else if(validNotificationsResponse() && notificationResponse.count > 0) { body = notificationResponse.getNotificationText(); } else if(validInboxResponse()) { body = inboxResponse.getText(); } return body; } BodyBuilder(NotificationsResponse notificationsResponse, InboxResponse inboxResponse); String build(); }
BodyBuilder extends UpdateBuilder { public String build() { String body = ""; if(validNotificationsResponse() && validInboxResponse() && notificationResponse.count > 0 && inboxResponse.count > 0) { Date notificationDate = notificationResponse.getNotificationDate(); Date messageDate = inboxResponse.time; body = notificationDate.getTime() > messageDate.getTime() ? notificationResponse.getNotificationText() : inboxResponse.getText(); } else if(validNotificationsResponse() && notificationResponse.count > 0) { body = notificationResponse.getNotificationText(); } else if(validInboxResponse()) { body = inboxResponse.getText(); } return body; } BodyBuilder(NotificationsResponse notificationsResponse, InboxResponse inboxResponse); String build();  }