Coverage Report - org.mule.example.loanbroker.lender.DefaultLender
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultLender
0%
0/15
0%
0/6
2
 
 1  
 /*
 2  
  * $Id: DefaultLender.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.example.loanbroker.lender;
 12  
 
 13  
 import org.mule.example.loanbroker.bank.Bank;
 14  
 import org.mule.example.loanbroker.messages.CreditProfile;
 15  
 import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest;
 16  
 
 17  
 /**
 18  
  * <code>DefaultLenderService</code> is responsible for contacting the relivant
 19  
  * banks depending on the amount of the loan
 20  
  */
 21  0
 public class DefaultLender implements LenderService
 22  
 {
 23  
     /**
 24  
      * Sets the list of lenders on the LoanBrokerQuoteRequest and returns it.
 25  
      */
 26  
     public void setLenderList(LoanBrokerQuoteRequest request)
 27  
     {
 28  0
         Bank[] lenders = getLenders(request.getCreditProfile(), new Double(request.getCustomerRequest()
 29  
             .getLoanAmount()));
 30  0
         request.setLenders(lenders);
 31  0
     }
 32  
 
 33  
     /**
 34  
      * {@inheritDoc}
 35  
      */
 36  
     public Bank[] getLenders(CreditProfile creditProfile, Double loanAmount)
 37  
     {
 38  
         // TODO Add creditProfile info. to the logic below.
 39  
         // TODO Look up the existing banks from the config/registry instead of
 40  
         // creating them programatically here.
 41  
         Bank[] lenders;
 42  0
         if ((loanAmount.doubleValue() >= 20000))
 43  
         {
 44  0
             lenders = new Bank[2];
 45  0
             lenders[0] = new Bank("Bank1");
 46  0
             lenders[1] = new Bank("Bank2");
 47  
         }
 48  0
         else if (((loanAmount.doubleValue() >= 10000) && (loanAmount.doubleValue() <= 19999)))
 49  
         {
 50  0
             lenders = new Bank[2];
 51  0
             lenders[0] = new Bank("Bank3");
 52  0
             lenders[1] = new Bank("Bank4");
 53  
         }
 54  
         else
 55  
         {
 56  0
             lenders = new Bank[1];
 57  0
             lenders[0] = new Bank("Bank5");
 58  
         }
 59  
 
 60  0
         return lenders;
 61  
     }
 62  
 }