001 /* 002 * Created on Sep 26, 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 * Mechanism for extending assertion classes. 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 Mikhail Mazursky 026 */ 027 public interface ExtensionPoints<S, A> { 028 029 /** 030 * Verifies that the actual value satisfies the given condition. This method is an alias for 031 * <code>{@link #has(Condition)}</code>. 032 * @param condition the given condition. 033 * @return {@code this ExtensionPoints} object. 034 * @throws NullPointerException if the given condition is {@code null}. 035 * @throws AssertionError if the actual value does not satisfy the given condition. 036 * @see #is(Condition) 037 */ 038 S is(Condition<? super A> condition); 039 040 /** 041 * Verifies that the actual value does not satisfy the given condition. This method is an alias for 042 * <code>{@link #doesNotHave(Condition)}</code>. 043 * @param condition the given condition. 044 * @return {@code this ExtensionPoints} object. 045 * @throws NullPointerException if the given condition is {@code null}. 046 * @throws AssertionError if the actual value satisfies the given condition. 047 * @see #isNot(Condition) 048 */ 049 S isNot(Condition<? super A> condition); 050 051 /** 052 * Verifies that the actual value satisfies the given condition. This method is an alias for 053 * <code>{@link #is(Condition)}</code>. 054 * @param condition the given condition. 055 * @return {@code this ExtensionPoints} object. 056 * @throws NullPointerException if the given condition is {@code null}. 057 * @throws AssertionError if the actual value does not satisfy the given condition. 058 * @see #is(Condition) 059 */ 060 S has(Condition<? super A> condition); 061 062 /** 063 * Verifies that the actual value does not satisfy the given condition. This method is an alias for 064 * <code>{@link #isNot(Condition)}</code>. 065 * @param condition the given condition. 066 * @return {@code this ExtensionPoints} object. 067 * @throws NullPointerException if the given condition is {@code null}. 068 * @throws AssertionError if the actual value satisfies the given condition. 069 * @see #isNot(Condition) 070 */ 071 S doesNotHave(Condition<? super A> condition); 072 }