BmiCalculator { public BmiValue calculate(float heightInMeter, float weightInKg) { if (heightInMeter < 0 || weightInKg < 0) { throw new RuntimeException("身長・体重には正の実数を指定してください"); } float bmiValue = weightInKg / (heightInMeter * heightInMeter); return createValueObj(bmiValue); }  BmiValue calculate(float heightInMeter, float weightInKg);  }
@Test(expected = RuntimeException.class) public void 身長に負の値を渡すと例外が発生する() { calculator.calculate(-1f, 60.0f);