### Question:
BodyMassIndex { public Double calculate(Double weight, Double height) { Validate.notNull(weight, "Your weight cannot be null"); Validate.notNull(height, "Your height cannot be null"); Validate.validState(weight.doubleValue() > 0, "Your weight cannot be zero"); Validate.validState(height.doubleValue() > 0, "Your height cannot be zero"); Double tmp = weight / (height * height); BigDecimal result = new BigDecimal(tmp); MathContext mathContext = new MathContext(4); result = result.round(mathContext); return result.doubleValue(); }  Double calculate(Double weight, Double height);  }### Answer:
@Test public void test_valid_inputs() { final Double expectedResult = 26.23; Double result = instance.calculate(85.0, 1.8); assertEquals(expectedResult, result); }
@Test(expected = NullPointerException.class) public void test_null_weight_input() { instance.calculate(null, 1.8); }
@Test(expected = NullPointerException.class) public void test_null_height_input() { instance.calculate(75.0, null); }
@Test(expected = IllegalStateException.class) public void test_zero_height_input() { instance.calculate(75.0, 0.0); }
@Test(expected = IllegalStateException.class) public void test_zero_weight_input() { instance.calculate(0.0, 1.8); }