@Test public void throw_invalid_pregnant_number_exception_if_positiveNumber_is_empty_string() throws InvalidPregnantMonthNumberException { thrown.expect(InvalidPregnantMonthNumberException.class); PregnantMonthNumber pregnantMonthNumber = PregnantMonthNumber.parse(""); }
public static PregnantMonthNumber parse(String positiveNumber) throws InvalidPregnantMonthNumberException { int numericValue; try { numericValue = Integer.parseInt(positiveNumber); } catch (NumberFormatException e) { throw new InvalidPregnantMonthNumberException("Invalid positive Number"); } return new PregnantMonthNumber(numericValue); }
PregnantMonthNumber { public static PregnantMonthNumber parse(String positiveNumber) throws InvalidPregnantMonthNumberException { int numericValue; try { numericValue = Integer.parseInt(positiveNumber); } catch (NumberFormatException e) { throw new InvalidPregnantMonthNumberException("Invalid positive Number"); } return new PregnantMonthNumber(numericValue); } }
PregnantMonthNumber { public static PregnantMonthNumber parse(String positiveNumber) throws InvalidPregnantMonthNumberException { int numericValue; try { numericValue = Integer.parseInt(positiveNumber); } catch (NumberFormatException e) { throw new InvalidPregnantMonthNumberException("Invalid positive Number"); } return new PregnantMonthNumber(numericValue); } PregnantMonthNumber(int value); }
PregnantMonthNumber { public static PregnantMonthNumber parse(String positiveNumber) throws InvalidPregnantMonthNumberException { int numericValue; try { numericValue = Integer.parseInt(positiveNumber); } catch (NumberFormatException e) { throw new InvalidPregnantMonthNumberException("Invalid positive Number"); } return new PregnantMonthNumber(numericValue); } PregnantMonthNumber(int value); static PregnantMonthNumber parse(String positiveNumber); int getValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
PregnantMonthNumber { public static PregnantMonthNumber parse(String positiveNumber) throws InvalidPregnantMonthNumberException { int numericValue; try { numericValue = Integer.parseInt(positiveNumber); } catch (NumberFormatException e) { throw new InvalidPregnantMonthNumberException("Invalid positive Number"); } return new PregnantMonthNumber(numericValue); } PregnantMonthNumber(int value); static PregnantMonthNumber parse(String positiveNumber); int getValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }