Java Code Examples for org.hamcrest.Matchers#allOf()
The following examples show how to use
org.hamcrest.Matchers#allOf() .
These examples are extracted from open source projects.
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 Project: cortado File: Cortado_Tests.java License: 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 2
Source Project: cortado File: Cortado_Tests.java License: 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 3
Source Project: cortado File: Cortado_Tests.java License: 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 4
Source Project: cortado File: Cortado_Tests.java License: 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 5
Source Project: cortado File: Cortado_Tests.java License: 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 6
Source Project: cortado File: Cortado_Tests.java License: 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 7
Source Project: cortado File: Cortado_Tests.java License: 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 8
Source Project: cortado File: Cortado_Tests.java License: 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 9
Source Project: cortado File: Cortado_Tests.java License: 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 10
Source Project: buck File: RuleAnalysisRulesBuildIntegrationTest.java License: 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 11
Source Project: morf File: TestDatabaseMetaDataProvider.java License: 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 12
Source Project: morf File: TestDatabaseMetaDataProvider.java License: 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 13
Source Project: intellijcoder File: TestUtil.java License: 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 14
Source Project: espresso-samples File: TestUtils.java License: Apache License 2.0 | 4 votes |
public Matcher<View> getConstraints() { return Matchers.allOf(new Matcher[] { ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed() }); }
Example 15
Source Project: Awesome-WanAndroid File: TestUtils.java License: Apache License 2.0 | 4 votes |
public Matcher<View> getConstraints() { return Matchers.allOf(new Matcher[] { ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed() }); }
Example 16
Source Project: Awesome-WanAndroid File: TestUtils.java License: Apache License 2.0 | 4 votes |
public Matcher<View> getConstraints() { return Matchers.allOf(new Matcher[] { ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed() }); }
Example 17
Source Project: cortado File: Linker.java License: Apache License 2.0 | 4 votes |
@Override Matcher<? super View> link(List<Matcher<? super View>> matchers) { return Matchers.allOf(matchers); }
Example 18
Source Project: java-mammoth File: ResultMatchers.java License: 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 19
Source Project: yandex-money-sdk-android File: ViewGroupInteraction.java License: MIT License | 4 votes |
public ViewGroupInteraction onChildView(Matcher<View> matcher) { //noinspection unchecked return new ViewGroupInteraction(Matchers.allOf(withParent(groupMatcher), matcher)); }
Example 20
Source Project: Scoops File: TestUtils.java License: Apache License 2.0 | 4 votes |
public Matcher<View> getConstraints() { return Matchers.allOf(new Matcher[]{ ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed() }); }