@Test public void shouldCheckLinkIsNotOnTime() { Link outOfTimeLink = new Link(); Date yesterday = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(yesterday); cal.add(Calendar.DATE, -1); yesterday = cal.getTime(); outOfTimeLink.setInsertDate(yesterday); boolean isOnTime = sut.isOnTime(outOfTimeLink); assertThat(isOnTime, is(false)); }
public boolean isOnTime(Link link) { Date nowDate = new Date(); Date insertDate = link.getInsertDate(); Calendar cal = Calendar.getInstance(); cal.setTime(insertDate); int dayOfInsertion = cal.get(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, dayOfInsertion+1); return nowDate.before(cal.getTime()); }
LinkBean extends BaseBean { public boolean isOnTime(Link link) { Date nowDate = new Date(); Date insertDate = link.getInsertDate(); Calendar cal = Calendar.getInstance(); cal.setTime(insertDate); int dayOfInsertion = cal.get(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, dayOfInsertion+1); return nowDate.before(cal.getTime()); } }
LinkBean extends BaseBean { public boolean isOnTime(Link link) { Date nowDate = new Date(); Date insertDate = link.getInsertDate(); Calendar cal = Calendar.getInstance(); cal.setTime(insertDate); int dayOfInsertion = cal.get(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, dayOfInsertion+1); return nowDate.before(cal.getTime()); } LinkBean();  LinkBean(String name); }
LinkBean extends BaseBean { public boolean isOnTime(Link link) { Date nowDate = new Date(); Date insertDate = link.getInsertDate(); Calendar cal = Calendar.getInstance(); cal.setTime(insertDate); int dayOfInsertion = cal.get(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, dayOfInsertion+1); return nowDate.before(cal.getTime()); } LinkBean();  LinkBean(String name); void setName(String name); String getName(); void setLink(String link); String getLink(); List<User> getUserWithName(String name); Link generateLink(String name); void sendMail(Link link, String mailAddress); String passwordResetRequest(); List<Link> getLinksWithLink(String link); void deleteLinkFromBD(Link link); String checkLinkAndResetPassword(String link); String resetPassword(User user); boolean isOnTime(Link link); String goPasswordChange(); }
LinkBean extends BaseBean { public boolean isOnTime(Link link) { Date nowDate = new Date(); Date insertDate = link.getInsertDate(); Calendar cal = Calendar.getInstance(); cal.setTime(insertDate); int dayOfInsertion = cal.get(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, dayOfInsertion+1); return nowDate.before(cal.getTime()); } LinkBean();  LinkBean(String name); void setName(String name); String getName(); void setLink(String link); String getLink(); List<User> getUserWithName(String name); Link generateLink(String name); void sendMail(Link link, String mailAddress); String passwordResetRequest(); List<Link> getLinksWithLink(String link); void deleteLinkFromBD(Link link); String checkLinkAndResetPassword(String link); String resetPassword(User user); boolean isOnTime(Link link); String goPasswordChange();  }