Clover coverage report - Maven Clover report
Coverage timestamp: Sun Mar 18 2007 17:42:32 CET
file stats: LOC: 81   Methods: 7
NCLOC: 41   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AbstractConstraint.java 100% 100% 100% 100%
coverage
 1    package com.agical.rmock.core.match.constraint;
 2   
 3    import java.io.IOException;
 4   
 5    import com.agical.rmock.core.describe.ExpressionDescriber;
 6    import com.agical.rmock.core.match.Constraint;
 7    import com.agical.rmock.core.match.Reference;
 8    import com.agical.rmock.core.match.operator.AbstractExpression;
 9    import com.agical.rmock.core.match.reference.ReferenceFactory;
 10   
 11    /**
 12    * <em>(c) Agical AB 2005</em>
 13    * @author joakim.ohlrogge
 14    *
 15   
 16    */
 17    public abstract class AbstractConstraint extends AbstractExpression implements Constraint {
 18    private final String name;
 19    private final Reference reference;
 20   
 21    /**
 22    * @see com.agical.rmock.core.match.Constraint#getName()
 23    */
 24  13 public String getName() {
 25  13 return name;
 26    }
 27   
 28    /**
 29    * @see com.agical.rmock.core.match.Constraint#getReference()
 30    */
 31  1208 public Reference getReference() {
 32  1208 return reference;
 33    }
 34   
 35   
 36   
 37    /**
 38    *
 39    */
 40  7293 public AbstractConstraint(String name, Object reference) {
 41  7293 this.name = name;
 42  7293 this.reference = (new ReferenceFactory()).create(reference);
 43    }
 44   
 45    /**
 46    * @throws IOException
 47    * @see Constraint#describeTo(ExpressionDescriber)
 48    */
 49  13 public void describeWith(ExpressionDescriber constraintDescriber) throws IOException {
 50  13 constraintDescriber.describe(this);
 51    }
 52   
 53    /**
 54    * @see java.lang.Object#hashCode()
 55    */
 56  1 public int hashCode() {
 57  1 return reference.getObject().hashCode();
 58    }
 59   
 60    /**
 61    * @see java.lang.Object#equals(java.lang.Object)
 62    */
 63  53 public boolean equals(Object other) {
 64  53 if( other == null) {
 65  1 return false;
 66    }
 67  52 if (reference.getObject() == null) {
 68  1 return (((AbstractConstraint)other).reference.getObject() == null);
 69    }
 70  51 return reference.getObject().equals(((AbstractConstraint)other).reference.getObject());
 71    }
 72   
 73    /**
 74    * @see java.lang.Object#toString()
 75    */
 76  1 public String toString() {
 77  1 StringBuffer sb = new StringBuffer();
 78  1 sb.append("name: ").append(name).append(", reference: ").append(reference.getObject());
 79  1 return sb.toString();
 80    }
 81    }