PeriodConverter implements Converter<String, Period> { @Override public Period convert(String source) { long sourceAsLong = Long.valueOf(source); return new Period(sourceAsLong); }  @Override Period convert(String source);  }
@Test public void testConvert() { PeriodConverter periodConverter = new PeriodConverter(); Period expResult = new Period(0, 1, 0, 0); Period result = periodConverter.convert("60000"); assertEquals(expResult, result); }
@Test(expected = NumberFormatException.class) public void testConvertNull() { PeriodConverter periodConverter = new PeriodConverter(); periodConverter.convert(null); }
@Test(expected = NumberFormatException.class) public void testConvertInvalid() { PeriodConverter periodConverter = new PeriodConverter(); periodConverter.convert("invalid"); }