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