@Test public void should_not_accept_from_that_more_than_upper_bound() throws Exception { expected.expect(IllegalArgumentException.class); expected.expectMessage("From should be within bounds [ 0, 59 ]"); mTimePattern.setIncrement(0, 100); }
public void setIncrement(int interval, int from) { validateWithinBounds(interval, String.format("Interval should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); validateWithinBounds(from, String.format("From should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); mPattern.setLength(0); mPattern.append(String.valueOf(interval)) .append("/") .append(String.valueOf(from)); }
TimePattern { public void setIncrement(int interval, int from) { validateWithinBounds(interval, String.format("Interval should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); validateWithinBounds(from, String.format("From should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); mPattern.setLength(0); mPattern.append(String.valueOf(interval)) .append("/") .append(String.valueOf(from)); } }
TimePattern { public void setIncrement(int interval, int from) { validateWithinBounds(interval, String.format("Interval should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); validateWithinBounds(from, String.format("From should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); mPattern.setLength(0); mPattern.append(String.valueOf(interval)) .append("/") .append(String.valueOf(from)); } TimePattern(int lowerBound, int higherBound); }
TimePattern { public void setIncrement(int interval, int from) { validateWithinBounds(interval, String.format("Interval should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); validateWithinBounds(from, String.format("From should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); mPattern.setLength(0); mPattern.append(String.valueOf(interval)) .append("/") .append(String.valueOf(from)); } TimePattern(int lowerBound, int higherBound); void setRange(int start, int end); @Override String toString(); void setValue(int value); void setIncrement(int interval, int from); void setRawValue(String rawValue); String parse(String rawValue); }
TimePattern { public void setIncrement(int interval, int from) { validateWithinBounds(interval, String.format("Interval should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); validateWithinBounds(from, String.format("From should be within bounds [ %d, %d ]", mLowerBound, mHigherBound)); mPattern.setLength(0); mPattern.append(String.valueOf(interval)) .append("/") .append(String.valueOf(from)); } TimePattern(int lowerBound, int higherBound); void setRange(int start, int end); @Override String toString(); void setValue(int value); void setIncrement(int interval, int from); void setRawValue(String rawValue); String parse(String rawValue);  }