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