@Test(expected = IllegalArgumentException.class) public void valueOf_tooHigh() { ScrollSpeed.of(ScrollSpeed.MAX_VALUE + 1); }
public static ScrollSpeed of(int speed) { if (speed < MIN_VALUE || speed > MAX_VALUE) { throw new IllegalArgumentException("Invalid speed value : " + speed + ". Acceptable values are in range [1..7]."); } return CACHE[speed - MIN_VALUE]; }
ScrollSpeed { public static ScrollSpeed of(int speed) { if (speed < MIN_VALUE || speed > MAX_VALUE) { throw new IllegalArgumentException("Invalid speed value : " + speed + ". Acceptable values are in range [1..7]."); } return CACHE[speed - MIN_VALUE]; } }
ScrollSpeed { public static ScrollSpeed of(int speed) { if (speed < MIN_VALUE || speed > MAX_VALUE) { throw new IllegalArgumentException("Invalid speed value : " + speed + ". Acceptable values are in range [1..7]."); } return CACHE[speed - MIN_VALUE]; } private  ScrollSpeed(int scrollSpeed); }
ScrollSpeed { public static ScrollSpeed of(int speed) { if (speed < MIN_VALUE || speed > MAX_VALUE) { throw new IllegalArgumentException("Invalid speed value : " + speed + ". Acceptable values are in range [1..7]."); } return CACHE[speed - MIN_VALUE]; } private  ScrollSpeed(int scrollSpeed); static ScrollSpeed of(int speed); int getScrollSpeed(); @Override boolean equals(Object o); @Override int hashCode(); }
ScrollSpeed { public static ScrollSpeed of(int speed) { if (speed < MIN_VALUE || speed > MAX_VALUE) { throw new IllegalArgumentException("Invalid speed value : " + speed + ". Acceptable values are in range [1..7]."); } return CACHE[speed - MIN_VALUE]; } private  ScrollSpeed(int scrollSpeed); static ScrollSpeed of(int speed); int getScrollSpeed(); @Override boolean equals(Object o); @Override int hashCode(); static final int MIN_VALUE; static final int MAX_VALUE; static final ScrollSpeed SPEED_MIN; static final ScrollSpeed SPEED_MAX; }