Java Code Examples for org.hamcrest.Matchers#allOf()
The following examples show how to use
org.hamcrest.Matchers#allOf() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestUtil.java From intellijcoder with MIT License | 5 votes |
public static <T> Matcher<T[]> hasItemsInArray(Matcher<T>... items) { Collection<Matcher<? super T[]>> matchers = new ArrayList<Matcher<? super T[]>>(items.length); for (Matcher<T> item : items) { matchers.add(hasItemInArray(item)); } return Matchers.allOf(matchers); }
Example 2
Source File: TestDatabaseMetaDataProvider.java From morf with Apache License 2.0 | 5 votes |
private static Matcher<? super Index> indexMatcher(Index index) { Matcher<Index> subMatchers = Matchers.allOf(ImmutableList.of( propertyMatcher(Index::getName, "name", indexNameEqualTo(index.getName())), propertyMatcher(Index::columnNames, "columns", contains(indexColumnNamesEqualTo(index.columnNames()))), propertyMatcher(Index::isUnique, "unique", equalTo(index.isUnique())) )); return Matchers.describedAs("%0", subMatchers, index.toString()); }
Example 3
Source File: Cortado_Tests.java From cortado with Apache License 2.0 | 5 votes |
@Test public void textView_returnsProperMatcher() { //given final Cortado.OrAnd.Matcher matcher = Cortado.textView().withText("test"); final Matcher<View> expectedEspressoMatcher = Matchers.allOf( ViewMatchers.isAssignableFrom(TextView.class), matcher.getCortado().matchers.get(0)); //when //then Utils.assertThat(matcher).isEqualTo(expectedEspressoMatcher); }
Example 4
Source File: Cortado_Tests.java From cortado with Apache License 2.0 | 5 votes |
@Test public void button_returnsProperMatcher() { //given final Cortado.OrAnd.Matcher matcher = Cortado.button().withText("test"); final Matcher<View> expectedEspressoMatcher = Matchers.allOf( ViewMatchers.isAssignableFrom(Button.class), matcher.getCortado().matchers.get(0)); //when //then Utils.assertThat(matcher).isEqualTo(expectedEspressoMatcher); }
Example 5
Source File: Cortado_Tests.java From cortado with Apache License 2.0 | 5 votes |
@Test public void imageView_returnsProperMatcher() { //given final Cortado.OrAnd.Matcher matcher = Cortado.imageView().withText("test"); final Matcher<View> expectedEspressoMatcher = Matchers.allOf( ViewMatchers.isAssignableFrom(ImageView.class), matcher.getCortado().matchers.get(0)); //when //then Utils.assertThat(matcher).isEqualTo(expectedEspressoMatcher); }
Example 6
Source File: Cortado_Tests.java From cortado with Apache License 2.0 | 5 votes |
@Test public void imageButton_returnsProperMatcher() { //given final Cortado.OrAnd.Matcher matcher = Cortado.imageButton().withText("test"); final Matcher<View> expectedEspressoMatcher = Matchers.allOf( ViewMatchers.isAssignableFrom(ImageButton.class), matcher.getCortado().matchers.get(0)); //when //then Utils.assertThat(matcher).isEqualTo(expectedEspressoMatcher); }
Example 7
Source File: Cortado_Tests.java From cortado with Apache License 2.0 | 5 votes |
@Test public void onTextView_returnsProperViewInteraction() { //given final Cortado.OrAnd.ViewInteraction viewInteraction = Cortado.onTextView().withText("test"); final Matcher<View> expectedEspressoMatcher = Matchers.allOf( ViewMatchers.isAssignableFrom(TextView.class), viewInteraction.getCortado().matchers.get(0)); //when final Matcher<View> rawMatcher = viewInteraction.getCortado().get(); //then Utils.assertThat(rawMatcher).isEqualTo(expectedEspressoMatcher); }
Example 8
Source File: Cortado_Tests.java From cortado with Apache License 2.0 | 5 votes |
@Test public void onEditText_returnsProperViewInteraction() { //given final Cortado.OrAnd.ViewInteraction viewInteraction = Cortado.onEditText().withText("test"); final Matcher<View> expectedEspressoMatcher = Matchers.allOf( ViewMatchers.isAssignableFrom(EditText.class), viewInteraction.getCortado().matchers.get(0)); //when final Matcher<View> rawMatcher = viewInteraction.getCortado().get(); //then Utils.assertThat(rawMatcher).isEqualTo(expectedEspressoMatcher); }
Example 9
Source File: Cortado_Tests.java From cortado with Apache License 2.0 | 5 votes |
@Test public void onButton_returnsProperViewInteraction() { //given final Cortado.OrAnd.ViewInteraction viewInteraction = Cortado.onButton().withText("test"); final Matcher<View> expectedEspressoMatcher = Matchers.allOf( ViewMatchers.isAssignableFrom(Button.class), viewInteraction.getCortado().matchers.get(0)); //when final Matcher<View> rawMatcher = viewInteraction.getCortado().get(); //then Utils.assertThat(rawMatcher).isEqualTo(expectedEspressoMatcher); }
Example 10
Source File: Cortado_Tests.java From cortado with Apache License 2.0 | 5 votes |
@Test public void onImageView_returnsProperViewInteraction() { //given final Cortado.OrAnd.ViewInteraction viewInteraction = Cortado.onImageView().withText("test"); final Matcher<View> expectedEspressoMatcher = Matchers.allOf( ViewMatchers.isAssignableFrom(ImageView.class), viewInteraction.getCortado().matchers.get(0)); //when final Matcher<View> rawMatcher = viewInteraction.getCortado().get(); //then Utils.assertThat(rawMatcher).isEqualTo(expectedEspressoMatcher); }
Example 11
Source File: Cortado_Tests.java From cortado with Apache License 2.0 | 5 votes |
@Test public void onImageButton_returnsProperViewInteraction() { //given final Cortado.OrAnd.ViewInteraction viewInteraction = Cortado.onImageButton().withText("test"); final Matcher<View> expectedEspressoMatcher = Matchers.allOf( ViewMatchers.isAssignableFrom(ImageButton.class), viewInteraction.getCortado().matchers.get(0)); //when final Matcher<View> rawMatcher = viewInteraction.getCortado().get(); //then Utils.assertThat(rawMatcher).isEqualTo(expectedEspressoMatcher); }
Example 12
Source File: RuleAnalysisRulesBuildIntegrationTest.java From buck with Apache License 2.0 | 5 votes |
private Matcher<Map<String, Object>> ruleOutputToMatchers(RuleOutput ruleOutput) { Matcher<Map<? extends String, ? extends Object>> targetMatcher = Matchers.hasEntry("target", ruleOutput.target); Matcher<Map<? extends String, ? extends Object>> valMatcher = Matchers.hasEntry("val", ruleOutput.val); Matcher<Object> srcs = createEndOfPathMatcher(ruleOutput.srcs); Matcher<Object> deps = (Matcher<Object>) (Matcher<? extends Object>) Matchers.containsInAnyOrder( Collections2.transform( ruleOutput.deps, d -> (Matcher<? super Object>) (Matcher<?>) ruleOutputToMatchers(d))); Matcher<Object> outputs = createEndOfPathMatcher(ruleOutput.outputs); Matcher<Map<? extends String, ? extends Object>> srcsMatcher = Matchers.hasEntry(Matchers.is("srcs"), srcs); Matcher<Map<? extends String, ? extends Object>> depMatcher = Matchers.hasEntry(Matchers.is("dep"), deps); Matcher<Map<? extends String, ? extends Object>> outputsMatcher = Matchers.hasEntry(Matchers.is("outputs"), outputs); Matcher<? extends Map<? extends String, ? extends Object>> matcher = Matchers.allOf(targetMatcher, valMatcher, srcsMatcher, depMatcher, outputsMatcher); return (Matcher<Map<String, Object>>) matcher; }
Example 13
Source File: TestDatabaseMetaDataProvider.java From morf with Apache License 2.0 | 5 votes |
private static Matcher<? super View> viewNameMatcher(String viewName) { Matcher<View> subMatchers = Matchers.allOf(ImmutableList.of( propertyMatcher(View::getName, "name", viewNameEqualTo(viewName)) )); return Matchers.describedAs("%0", subMatchers, viewName); }
Example 14
Source File: TestUtils.java From Scoops with Apache License 2.0 | 4 votes |
public Matcher<View> getConstraints() { return Matchers.allOf(new Matcher[]{ ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed() }); }
Example 15
Source File: TestUtils.java From espresso-samples with Apache License 2.0 | 4 votes |
public Matcher<View> getConstraints() { return Matchers.allOf(new Matcher[] { ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed() }); }
Example 16
Source File: ViewGroupInteraction.java From yandex-money-sdk-android with MIT License | 4 votes |
public ViewGroupInteraction onChildView(Matcher<View> matcher) { //noinspection unchecked return new ViewGroupInteraction(Matchers.allOf(withParent(groupMatcher), matcher)); }
Example 17
Source File: ResultMatchers.java From java-mammoth with BSD 2-Clause "Simplified" License | 4 votes |
public static Matcher<Result<?>> isResult(Matcher<?> valueMatcher, Iterable<String> warnings) { return Matchers.allOf( hasProperty("value", valueMatcher), hasWarnings(warnings)); }
Example 18
Source File: Linker.java From cortado with Apache License 2.0 | 4 votes |
@Override Matcher<? super View> link(List<Matcher<? super View>> matchers) { return Matchers.allOf(matchers); }
Example 19
Source File: TestUtils.java From Awesome-WanAndroid with Apache License 2.0 | 4 votes |
public Matcher<View> getConstraints() { return Matchers.allOf(new Matcher[] { ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed() }); }
Example 20
Source File: TestUtils.java From Awesome-WanAndroid with Apache License 2.0 | 4 votes |
public Matcher<View> getConstraints() { return Matchers.allOf(new Matcher[] { ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed() }); }