1/* Copyright (c) 2000-2006 hamcrest.org 2 */ 3package org.hamcrest.number; 4 5import org.hamcrest.Description; 6import org.hamcrest.TypeSafeMatcher; 7 8/** 9 * Is the value less than or greater than another {@link java.lang.Comparable} value? 10 */ 11public class IsGreaterThan<T extends Comparable<T>> extends TypeSafeMatcher<T> { 12 private final Comparable<T> compareTo; 13 14 public IsGreaterThan(Comparable<T> compareTo) { 15 this.compareTo = compareTo; 16 } 17 18 public boolean matchesSafely(T item) { 19 return compareTo.compareTo(item) < 0; 20 } 21 22 public void describeTo(Description description) { 23 description.appendText("a value greater than "); 24 description.appendValue(compareTo); 25 } 26} 27