Coverage Report - org.mule.tck.testmodels.fruit.Apple
 
Classes in this File Line Coverage Branch Coverage Complexity
Apple
0%
0/35
0%
0/7
1.75
 
 1  
 /*
 2  
  * $Id: Apple.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.tck.testmodels.fruit;
 12  
 
 13  
 import org.mule.umo.UMOEventContext;
 14  
 import org.mule.umo.UMOException;
 15  
 import org.mule.umo.lifecycle.Callable;
 16  
 
 17  
 import org.apache.commons.logging.Log;
 18  
 import org.apache.commons.logging.LogFactory;
 19  
 
 20  0
 public class Apple implements Fruit, Callable
 21  
 {
 22  
     /**
 23  
      * Serial version
 24  
      */
 25  
     private static final long serialVersionUID = -7631993371500076921L;
 26  
 
 27  
     /**
 28  
      * logger used by this class
 29  
      */
 30  0
     private static final Log logger = LogFactory.getLog(Apple.class);
 31  
 
 32  0
     private boolean bitten = false;
 33  0
     private boolean washed = false;
 34  
 
 35  
     private FruitCleaner cleaner;
 36  
 
 37  
     public void wash()
 38  
     {
 39  0
         if (cleaner != null)
 40  
         {
 41  0
             cleaner.wash(this);
 42  
         }
 43  0
         washed = true;
 44  0
     }
 45  
 
 46  
     public void polish()
 47  
     {
 48  0
         cleaner.polish(this);
 49  0
     }
 50  
 
 51  
     public boolean isWashed()
 52  
     {
 53  0
         return washed;
 54  
     }
 55  
 
 56  
     public void bite()
 57  
     {
 58  0
         bitten = true;
 59  0
     }
 60  
 
 61  
     public boolean isBitten()
 62  
     {
 63  0
         return bitten;
 64  
     }
 65  
 
 66  
     public Object onCall(UMOEventContext context) throws UMOException
 67  
     {
 68  0
         logger.debug("Apple received an event in UMOCallable.onEvent! Event says: "
 69  
                         + context.getMessageAsString());
 70  0
         wash();
 71  0
         return null;
 72  
     }
 73  
 
 74  
 
 75  
     public FruitCleaner getAppleCleaner()
 76  
     {
 77  0
         return cleaner;
 78  
     }
 79  
 
 80  
     public void setAppleCleaner(FruitCleaner cleaner)
 81  
     {
 82  0
         this.cleaner = cleaner;
 83  0
     }
 84  
 
 85  
     /**
 86  
      * Used in {@link org.mule.components.simple.NoArgsCallWrapper} tests.
 87  
      * @return will always return null
 88  
      */
 89  
     public Object methodReturningNull()
 90  
     {
 91  0
         return null;
 92  
     }
 93  
 
 94  
     public boolean equals(Object o)
 95  
     {
 96  0
         if (this == o)
 97  
         {
 98  0
             return true;
 99  
         }
 100  0
         if (o == null || getClass() != o.getClass())
 101  
         {
 102  0
             return false;
 103  
         }
 104  
 
 105  0
         final Apple apple = (Apple) o;
 106  
 
 107  0
         if (bitten != apple.bitten)
 108  
         {
 109  0
             return false;
 110  
         }
 111  0
         if (washed != apple.washed)
 112  
         {
 113  0
             return false;
 114  
         }
 115  
 
 116  0
         return true;
 117  
     }
 118  
 
 119  
     public int hashCode()
 120  
     {
 121  
         int result;
 122  0
         result = (bitten ? 1 : 0);
 123  0
         result = 29 * result + (washed ? 1 : 0);
 124  0
         return result;
 125  
     }
 126  
 
 127  
     public String toString()
 128  
     {
 129  0
         return "Just an apple.";
 130  
     }
 131  
 }