001 /*
002 * Created on Feb 8, 2011
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 @2011 the original author or authors.
014 */
015 package org.fest.assertions.api;
016
017 import org.fest.assertions.core.UnevenComparableAssert;
018
019 /**
020 * Base class for all implementations of <code>{@link UnevenComparableAssert}</code>.
021 * @param <S> the "self" type of this assertion class. Please read
022 * "<a href="http://bit.ly/anMa4g" target="_blank">Emulating 'self types' using Java Generics to simplify fluent
023 * API implementation</a>" for more details.
024 * @param <A> the type of the "actual" value.
025 *
026 * @author Alex Ruiz
027 * @author Mikhail Mazursky
028 */
029 public abstract class AbstractUnevenComparableAssert<S extends AbstractUnevenComparableAssert<S, A>, A extends Comparable<? super A>>
030 extends AbstractComparableAssert<S, A> implements UnevenComparableAssert<S, A> {
031
032 protected AbstractUnevenComparableAssert(A actual, Class<?> selfType) {
033 super(actual, selfType);
034 }
035
036 /** {@inheritDoc} */
037 public final S isEqualByComparingTo(A expected) {
038 comparables.assertEqualByComparison(info, actual, expected);
039 return myself;
040 }
041
042 /** {@inheritDoc} */
043 public final S isNotEqualByComparingTo(A other) {
044 comparables.assertNotEqualByComparison(info, actual, other);
045 return myself;
046 }
047 }