コード例 #1
0
 @Test
 public void test() {
   try {
     int result = taxCalculator.calculateTax(grossIncome);
     Assert.assertEquals(incomeTax, result);
     if (shouldThrowException) {
       Assert.fail("This test expected an exception to be thrown, but no exception was thrown.");
     }
   } catch (Exception e) {
     if (!shouldThrowException) {
       Assert.fail("Should not have thrown an exception: " + e.getMessage());
     }
   }
 }
コード例 #2
0
ファイル: Accountant.java プロジェクト: linhoo/dptraining
 double computeIncomeTax(double income) {
   return calculator.computeIncomeTax(income);
 }