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

org.testatoo.cartridge.html4.matcher.Matchers Maven / Gradle / Ivy

There is a newer version: 1.0-rc11
Show newest version
/**
 * Copyright (C) 2008 Ovea 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.testatoo.cartridge.html4.matcher;

import org.hamcrest.Matcher;
import org.testatoo.cartridge.html4.element.Option;
import org.testatoo.cartridge.html4.element.OptionGroup;
import org.testatoo.cartridge.html4.element.Select;

/**
 * This class defines the matchers (based on hamcrest matchers) used in testatoo tests and specific to html4 testing.
 *
 * @author [email protected]
 */

public class Matchers extends org.testatoo.core.matcher.Matchers {

    /**
     * To test the number of options in a select element, using the syntax "has(4, options())"
     *
     * @param num    the expected number of options
     * @param option the tested element, here : option
     * @return a new OptionSize matcher created with the given size
     */
    public static Matcher has(int num, OptionGroup[] optionGroups) {
        return OptionGroupSize.is(num);
    }

    /**
     * To test the number of something, using the syntax "has(4, xxxxxx())"
     *
     * @param num       the expected number
     * @param something the tested element, ex : visibleRows
     * @return a new matcher created with the given size
     */
    public static Matcher