WeeklyPeriod implements Period { @Override public String getAsIsoString() { return new SimpleDateFormat(ISO_FORMAT).format(getStartDate()); } WeeklyPeriod(Date date); @Override void setStartDate(Date startDate); @Override void setEndDate(Date endDate); @Override Date getStartDate(); @Override Date getEndDate(); @Override String getAsIsoString(); static final String ISO_FORMAT; }
@Test public void testGetAsIsoString() throws ParseException { WeeklyPeriod instance = new WeeklyPeriod(new SimpleDateFormat( "yyyy-MM-dd").parse("2012-11-20")); String expResult = "2012W47"; String result = instance.getAsIsoString(); assertEquals(expResult, result); }