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

com.googlecode.gwt.test.assertions.BaseFocusWidgetAssert 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.FocusWidget;

/**
 * Base class for all {@link FocusWidget} 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 BaseFocusWidgetAssert, A extends FocusWidget>
        extends BaseWidgetAssert {

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

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

        return myself;
    }

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

        return myself;
    }

}