001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 */
018
019package org.openqa.selenium.support.ui;
020
021import com.google.common.base.Function;
022
023/**
024 * A generic interface for waiting until a condition is true or not null. The condition may take a single argument of
025 * type .
026 *
027 * @param <F> the argument to pass to any function called
028 */
029public interface Wait<F> {
030
031    /**
032     * Implementations should wait until the condition evaluates to a value that is neither null nor false. Because of
033     * this contract, the return type must not be Void.
034     * <p>
035     * If the condition does not become true within a certain time (as defined by the implementing class), this method
036     * will throw a non-specified {@link Throwable}. This is so that an implementor may throw whatever is idiomatic for
037     * a given test infrastructure (e.g. JUnit4 would throw {@link AssertionError}.
038     *
039     * @param <T> the return type of the method, which must not be Void
040     * @param isTrue the parameter to pass to the {@link ExpectedCondition}
041     */
042    <T> T until(Function<F, T> isTrue);
043}