Coverage Report - org.mule.samples.voipservice.to.AddressTO
 
Classes in this File Line Coverage Branch Coverage Complexity
AddressTO
0%
0/43
0%
0/3
1.364
 
 1  
 /*
 2  
  * $Id: AddressTO.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.samples.voipservice.to;
 12  
 
 13  
 import org.mule.samples.voipservice.LocaleMessage;
 14  
 
 15  
 import java.io.Serializable;
 16  
 import java.util.ArrayList;
 17  
 import java.util.List;
 18  
 
 19  
 /**
 20  
  * @author Binildas Christudas
 21  
  */
 22  
 public class AddressTO implements Serializable, Cloneable
 23  
 {
 24  
     /**
 25  
      * Serial version
 26  
      */
 27  
     private static final long serialVersionUID = 6721555269589989794L;
 28  
 
 29  
     private String houseNumber;
 30  
     private String street;
 31  
     private String city;
 32  
 
 33  
     private static final List ADDRESSES;
 34  
 
 35  
     static
 36  
     {
 37  0
         ADDRESSES = new ArrayList();
 38  
 
 39  0
         ADDRESSES.add(new AddressTO("123", "Koudiar Palace", "Trivandrum"));
 40  0
         ADDRESSES.add(new AddressTO("222", "Lake View", "Cochin"));
 41  0
         ADDRESSES.add(new AddressTO("345", "Spencer Town", "Chennai"));
 42  0
         ADDRESSES.add(new AddressTO("898", "Electronics City", "Bangalore"));
 43  0
         ADDRESSES.add(new AddressTO("554", "Kovalam Beach", "Trivandrum"));
 44  0
         ADDRESSES.add(new AddressTO("101", "Anzyl Grove", "Pune"));
 45  0
         ADDRESSES.add(new AddressTO("369", "Victoria Terminus", "Mumbai"));
 46  0
         ADDRESSES.add(new AddressTO("876", "Ponmudi Hills", "Trivandrum"));
 47  0
         ADDRESSES.add(new AddressTO("777", "White Field", "Bangalore"));
 48  0
         ADDRESSES.add(new AddressTO("908", "Varkala Palms", "Trivandrum"));
 49  
 
 50  0
     }
 51  
 
 52  
     public AddressTO()
 53  
     {
 54  0
         super();
 55  0
     }
 56  
 
 57  
     public AddressTO(String houseNumber, String street, String city)
 58  0
     {
 59  
 
 60  0
         this.houseNumber = houseNumber;
 61  0
         this.street = street;
 62  0
         this.city = city;
 63  0
     }
 64  
 
 65  
     public void setHouseNumber(String houseNumber)
 66  
     {
 67  0
         this.houseNumber = houseNumber;
 68  0
     }
 69  
 
 70  
     public String getHouseNumber()
 71  
     {
 72  0
         return houseNumber;
 73  
     }
 74  
 
 75  
     public void setStreet(String street)
 76  
     {
 77  0
         this.street = street;
 78  0
     }
 79  
 
 80  
     public String getStreet()
 81  
     {
 82  0
         return street;
 83  
     }
 84  
 
 85  
     public void setCity(String city)
 86  
     {
 87  0
         this.city = city;
 88  0
     }
 89  
 
 90  
     public String getCity()
 91  
     {
 92  0
         return city;
 93  
     }
 94  
 
 95  
     public Object clone()
 96  
     {
 97  0
         Object clone = null;
 98  
         try
 99  
         {
 100  0
             clone = super.clone();
 101  
         }
 102  0
         catch (CloneNotSupportedException cloneNotSupportedException)
 103  
         {
 104  
             // too bad
 105  0
         }
 106  0
         return clone;
 107  
     }
 108  
 
 109  
     public String toString()
 110  
     {
 111  0
         StringBuffer stringBuffer = new StringBuffer();
 112  0
         if (this.houseNumber != null)
 113  
         {
 114  0
             stringBuffer.append(LocaleMessage.getHouseCaption(houseNumber));
 115  
         }
 116  0
         if (this.street != null)
 117  
         {
 118  0
             stringBuffer.append(LocaleMessage.getStreetCaption(street));
 119  
         }
 120  0
         if (this.city != null)
 121  
         {
 122  0
             stringBuffer.append(LocaleMessage.getCityCaption(city));
 123  
         }
 124  0
         return stringBuffer.toString();
 125  
     }
 126  
 
 127  
     public static AddressTO getRandomAddress()
 128  
     {
 129  
 
 130  0
         int index = new Double(Math.random() * 10).intValue();
 131  
         // AddressTO addressTO = (AddressTO) ADDRESSES.get(index);
 132  0
         return (AddressTO)((AddressTO)ADDRESSES.get(index)).clone();
 133  
     }
 134  
 
 135  
 }