Coverage Report - biz.xsoftware.examples.basic.SysUnderTest
 
Classes in this File Line Coverage Branch Coverage Complexity
SysUnderTest
100%
11/11
N/A
2
 
 1  
 /*
 2  
  * Created on Jun 28, 2004
 3  
  *
 4  
  * To change the template for this generated file go to
 5  
  * Window - Preferences - Java - Code Generation - Code and Comments
 6  
  */
 7  
 package biz.xsoftware.examples.basic;
 8  
 
 9  
 /**
 10  
  * The SysUnderTest here is a WebStore or something which needs
 11  
  * to authorize purchases.
 12  
  */
 13  
 public class SysUnderTest {
 14  
 
 15  
         private CreditAuthorizationSvc creditSvc;
 16  
         private GiftCardAccountSvc giftSvc;
 17  
 
 18  
         /**
 19  
          * @showcode
 20  
          */
 21  5
         public SysUnderTest(CreditAuthorizationSvc c, GiftCardAccountSvc g) {
 22  5
                 creditSvc = c;
 23  5
                 giftSvc = g;
 24  5
         }
 25  
 
 26  
         /**
 27  
          * @showcode
 28  
          */
 29  
         public void buyGiftCard(String user, double usDollars) {
 30  5
                 creditSvc.takeMoney(user, usDollars);
 31  
                 
 32  
                 try {
 33  3
                         giftSvc.putMoneyOnCard(456, usDollars);
 34  2
                 } catch(Throwable e) {
 35  2
                         creditSvc.returnMoney(user, usDollars);
 36  2
                         throw new PurchaseException(e);
 37  1
                 }
 38  1
                 return;
 39  
         }
 40  
 }