001 /*
002 * Created on Oct 17, 2010
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
005 * the License. You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
010 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
011 * specific language governing permissions and limitations under the License.
012 *
013 * Copyright @2010-2011 the original author or authors.
014 */
015 package org.fest.assertions.core;
016
017 /**
018 * Assertion methods applicable to <code>{@link Comparable}</code>s.
019 * @param <S> the "self" type of this assertion class. Please read
020 * "<a href="http://bit.ly/anMa4g" target="_blank">Emulating 'self types' using Java Generics to simplify fluent
021 * API implementation</a>" for more details.
022 * @param <A> the type of the "actual" value.
023 *
024 * @author Alex Ruiz
025 * @author Ted M. Young
026 */
027 public interface ComparableAssert<S, A extends Comparable<? super A>> {
028
029 /**
030 * Verifies that the actual value is less than the given one.
031 * @param other the given value to compare the actual value to.
032 * @return {@code this} assertion object.
033 * @throws AssertionError if the actual value is {@code null}.
034 * @throws AssertionError if the actual value is equal to or greater than the given one.
035 */
036 S isLessThan(A other);
037
038 /**
039 * Verifies that the actual value is less than or equal to the given one.
040 * @param other the given value to compare the actual value to.
041 * @return {@code this} assertion object.
042 * @throws AssertionError if the actual value is {@code null}.
043 * @throws AssertionError if the actual value is greater than the given one.
044 */
045 S isLessThanOrEqualTo(A other);
046
047 /**
048 * Verifies that the actual value is greater than the given one.
049 * @param other the given value to compare the actual value to.
050 * @return {@code this} assertion object.
051 * @throws AssertionError if the actual value is {@code null}.
052 * @throws AssertionError if the actual value is equal to or less than the given one.
053 */
054 S isGreaterThan(A other);
055
056 /**
057 * Verifies that the actual value is greater than or equal to the given one.
058 * @param other the given value to compare the actual value to.
059 * @return {@code this} assertion object.
060 * @throws AssertionError if the actual value is {@code null}.
061 * @throws AssertionError if the actual value is less than the given one.
062 */
063 S isGreaterThanOrEqualTo(A other);
064 }