All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.gwt.test.assertions.BasePopupPanelAssert Maven / Gradle / Ivy

There is a newer version: 0.63
Show newest version
package com.googlecode.gwt.test.assertions;

import com.google.gwt.user.client.ui.PopupPanel;

/**
 * Base class for all {@link PopupPanel} assertions.
 *
 * @param  used to simulate "self types." For more information please read "Emulating 'self types' using Java Generics to simplify fluent API
 *            implementation."
 * @param  the type of the "actual" value.
 * @author Gael Lazzari
 */
public class BasePopupPanelAssert, A extends PopupPanel>
        extends BaseWidgetAssert {

    /**
     * Creates a new {@link BasePopupPanelAssert}.
     *
     * @param actual   the actual value to verify.
     * @param selfType the "self type."
     */
    protected BasePopupPanelAssert(A actual, Class selfType) {
        super(actual, selfType);
    }

    /**
     * Verifies that the actual {@link PopupPanel} is modal.
     *
     * @return this assertion object.
     * @throws AssertionError if the actual {@link PopupPanel} is not modal.
     * @see PopupPanel#isModal()
     */
    public S isModal() {
        if (!actual.isModal())
            failWithMessage("should be modal");

        return myself;
    }

    /**
     * Verifies that the actual {@link PopupPanel} is not modal.
     *
     * @return this assertion object.
     * @throws AssertionError if the actual {@link PopupPanel} is modal.
     * @see PopupPanel#isModal()
     */
    public S isNotModal() {
        if (actual.isModal())
            failWithMessage("should not be modal");

        return myself;
    }

    /**
     * Verifies that the actual {@link PopupPanel} is not currently showing.
     *
     * @return this assertion object.
     * @throws AssertionError if the actual {@link PopupPanel} is showing.
     * @see PopupPanel#isShowing()
     */
    public S isNotShowing() {
        if (actual.isShowing())
            failWithMessage("should not be showing");

        return myself;
    }

    /**
     * Verifies that the actual {@link PopupPanel} is currently showing.
     *
     * @return this assertion object.
     * @throws AssertionError if the actual {@link PopupPanel} is not showing.
     * @see PopupPanel#isShowing()
     */
    public S isShowing() {
        if (!actual.isShowing())
            failWithMessage("should be showing");

        return myself;
    }

}