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 */
028 public abstract class AbstractUnevenComparableAssert<S, A extends Comparable<A>> extends
029 AbstractComparableAssert<S, A> implements UnevenComparableAssert<S, A> {
030
031 protected AbstractUnevenComparableAssert(A actual, Class<S> selfType) {
032 super(actual, selfType);
033 }
034
035 /** {@inheritDoc} */
036 public final S isEqualByComparingTo(A expected) {
037 comparables.assertEqualByComparison(info, actual, expected);
038 return myself;
039 }
040
041 /** {@inheritDoc} */
042 public final S isNotEqualByComparingTo(A other) {
043 comparables.assertNotEqualByComparison(info, actual, other);
044 return myself;
045 }
046 }