001    /*
002     * Created on Oct 19, 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    import java.math.BigDecimal;
018    
019    /**
020     * Assertion methods applicable to <code>{@link Comparable}</code>s whose implementation of {@code compareTo} is not
021     * consistent with their implementation of {@code equals} (e.g. <code>{@link BigDecimal}</code>.)
022     * @param <S> the "self" type of this assertion class. Please read
023     * &quot;<a href="http://bit.ly/anMa4g" target="_blank">Emulating 'self types' using Java Generics to simplify fluent
024     * API implementation</a>&quot; for more details.
025     * @param <T> the type of the "actual" value.
026     *
027     * @author Alex Ruiz
028     */
029    public interface UnevenComparableAssert<S, T extends Comparable<T>> extends ComparableAssert<S, T> {
030    
031      /**
032       * Verifies that the actual value is equal to the given one by invoking
033       * <code>{@link Comparable#compareTo(Object)}</code>.
034       * @param expected the given value to compare the actual value to.
035       * @return {@code this} assertion object.
036       * @throws AssertionError if the actual value is {@code null}.
037       * @throws AssertionError if the actual value is not equal to the given one.
038       */
039      S isEqualByComparingTo(T expected);
040    
041      /**
042       * Verifies that the actual value is not equal to the given one by invoking
043       * <code>{@link Comparable#compareTo(Object)}</code>.
044       * @param other the given value to compare the actual value to.
045       * @return {@code this} assertion object.
046       * @throws AssertionError if the actual value is {@code null}.
047       * @throws AssertionError if the actual value is equal to the given one.
048       */
049      S isNotEqualByComparingTo(T other);
050    }