### Question:
SizeConstraint { public void verify(int numMachines) throws InvalidClusterException { if (numMachines < min || numMachines > max) { throw new InvalidClusterException( "Size must be at least " + min + " but not greater than " + max + ". Now it's " + numMachines); } } SizeConstraint(Integer min, Integer max); void verify(int numMachines); int getMin(); int getMax(); @Override boolean equals(Object o); @Override int hashCode(); static final SizeConstraint EMPTY; }### Answer:
@Test(expected = InvalidClusterException.class) public void testSizeTooSmall() throws InvalidClusterException { SizeConstraint sizeConstraint = new SizeConstraint(3, 10); sizeConstraint.verify(2); }
@Test(expected = InvalidClusterException.class) public void testSizeTooBig() throws InvalidClusterException { SizeConstraint sizeConstraint = new SizeConstraint(3, 10); sizeConstraint.verify(11); }