KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmock > core > constraint > IsGreaterThan


1 /* Copyright (c) 2000-2004 jMock.org
2  */

3 package org.jmock.core.constraint;
4
5 import org.jmock.core.Constraint;
6
7
8 /**
9  * Is the value greater than another {@link java.lang.Comparable} value?
10  */

11 public class IsGreaterThan implements Constraint
12 {
13     private Comparable JavaDoc lowerLimit;
14
15     public IsGreaterThan( Comparable JavaDoc lowerLimit ) {
16         this.lowerLimit = lowerLimit;
17     }
18
19     public boolean eval( Object JavaDoc arg ) {
20         return lowerLimit.compareTo(arg) < 0;
21     }
22
23     public StringBuffer JavaDoc describeTo( StringBuffer JavaDoc buffer ) {
24         return buffer.append("a value greater than <")
25                 .append(lowerLimit)
26                 .append(">");
27     }
28 }
29
Popular Tags