sc.tyro.core.hamcrest.Matchers.groovy Maven / Gradle / Ivy
/**
* Copyright © 2020 Ovea ([email protected])
*
* 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 sc.tyro.core.hamcrest
import org.hamcrest.Matcher
import sc.tyro.core.component.Component
import sc.tyro.core.component.Group
import sc.tyro.core.component.Item
import sc.tyro.core.component.datagrid.Cell
import sc.tyro.core.component.datagrid.Column
import sc.tyro.core.component.datagrid.Row
import sc.tyro.core.hamcrest.matcher.property.*
import sc.tyro.core.hamcrest.matcher.state.*
import sc.tyro.core.support.property.*
import sc.tyro.core.support.state.*
/**
* @author David Avenante
* @since 1.0.0
*/
class Matchers {
static Matcher has(Matcher matcher) { new Has(matcher) }
// States
static Matcher enabled() { new EnabledMatcher() }
static Matcher disabled() { new DisabledMatcher() }
static Matcher available() { new AvailableMatcher() }
static Matcher missing() { new MissingMatcher() }
static Matcher visible() { new VisibleMatcher() }
static Matcher hidden() { new HiddenMatcher() }
static Matcher empty() { new EmptyMatcher() }
static Matcher filled() { new FilledMatcher() }
static Matcher focused() { new FocusedMatcher() }
static Matcher readOnly() { new ReadOnlyMatcher() }
static Matcher required() { new RequiredMatcher() }
static Matcher optional() { new OptionalMatcher() }
static Matcher checked() { new CheckedMatcher() }
static Matcher unchecked() { new UnCheckedMatcher() }
static Matcher selected() { new SelectedMatcher() }
static Matcher unselected() { new UnSelectedMatcher() }
static Matcher on() { new SwitchedOnMatcher() }
static Matcher off() { new SwitchedOffMatcher() }
static Matcher inRange() { new InRangeMatcher() }
static Matcher outOfRange() { new OutOfRangeMatcher() }
static Matcher valid() { new ValidMatcher() }
static Matcher invalid() { new InvalidMatcher() }
static Matcher contain(Component... components) { new ContainMatcher(components) }
static Matcher expanded() { new ExpandedMatcher() }
static Matcher collapsed() { new CollapsedMatcher() }
// Properties
static Matcher label(String label) { new LabelMatcher(label) }
static Matcher placeholder(String placeholder) { new PlaceholderMatcher(placeholder) }
static Matcher maximum(Object maximum) { new MaximumMatcher(maximum) }
static Matcher minimum(Object minimum) { new MinimumMatcher(minimum) }
static Matcher length(Object length) { new LengthMatcher(length) }
static Matcher step(Object minimum) { new StepMatcher(minimum) }
static Matcher text(String text) { new TextMatcher(text) }
static Matcher value(Object value) { new ValueMatcher(value) }
static Matcher reference(String source) { new ReferenceMatcher(source) }
static Matcher title(String title) { new TitleMatcher(title) }
static Matcher items(String... items) { new ItemMatcher(items) }
static Matcher items(Item... items) { new ItemMatcher(items) }
static Matcher selectedItem(String value) { new SelectedItemMatcher(value) }
static Matcher selectedItem(Item value) { new SelectedItemMatcher(value) }
static Matcher selectedItems(String... values) { new SelectedItemsMatcher(values) }
static Matcher selectedItems(Item... values) { new SelectedItemsMatcher(values) }
static Matcher groups(String... values) { new GroupMatcher(values) }
static Matcher groups(Group... values) { new GroupMatcher(values) }
static Matcher columns(String... values) { new ColumnMatcher(values) }
static Matcher columns(Column... values) { new ColumnMatcher(values) }
static Matcher rows(String... values) { new RowMatcher(values) }
static Matcher rows(Row... values) { new RowMatcher(values) }
static Matcher cells(String... values) { new CellMatcher(values) }
static Matcher cells(Cell... values) { new CellMatcher(values) }
}