@Test public void return_pregnant_number_if_text_to_parse_is_number_is_over_max() throws InvalidPregnantMonthNumberException { thrown.expect(InvalidPregnantMonthNumberException.class); PregnantMonthNumber.parse("15"); }
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();  }