WheelIndicatorItem { public void setWeight(float weight) { if (weight < 0 ) throw new IllegalArgumentException("weight value should be positive"); this.weight = weight; } WheelIndicatorItem();  WheelIndicatorItem(float weight,int color); void setWeight(float weight); float getWeight(); void setColor(int color); int getColor();  }
@Test(expected = IllegalArgumentException.class) public void setterShouldThrowExceptionWhenWeightIsNegative(){ WheelIndicatorItem item = new WheelIndicatorItem(); item.setWeight(-1); }