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