001 /*
002 * Created on Jul 25, 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 * Assertions applicable to groups of values that can be enumerated (e.g. arrays, collections or strings.)
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 *
023 * @author Yvonne Wang
024 * @author Alex Ruiz
025 */
026 public interface EnumerableAssert<S> {
027
028 /**
029 * Verifies that the actual group of values is {@code null} or empty.
030 * @throws AssertionError if the actual group of values is not {@code null} or not empty.
031 */
032 void isNullOrEmpty();
033
034 /**
035 * Verifies that the actual group of values is empty.
036 * @throws AssertionError if the actual group of values is not empty.
037 */
038 void isEmpty();
039
040 /**
041 * Verifies that the actual group of values is not empty.
042 * @return {@code this} assertion object.
043 * @throws AssertionError if the actual group of values is empty.
044 */
045 S isNotEmpty();
046
047 /**
048 * Verifies that the number of values in the actual group is equal to the given one.
049 * @param expected the expected number of values in the actual group.
050 * @return {@code this} assertion object.
051 * @throws AssertionError if the number of values of the actual group is not equal to the given one.
052 */
053 S hasSize(int expected);
054 }