org.hamcrest.Matchers#allOf ( )源码实例Demo

下面列出了org.hamcrest.Matchers#allOf ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: cortado   文件: Cortado_Tests.java
@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);
}
 
源代码2 项目: cortado   文件: Cortado_Tests.java
@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);
}
 
源代码3 项目: cortado   文件: Cortado_Tests.java
@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);
}
 
源代码4 项目: cortado   文件: Cortado_Tests.java
@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);
}
 
源代码5 项目: cortado   文件: Cortado_Tests.java
@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);
}
 
源代码6 项目: cortado   文件: Cortado_Tests.java
@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);
}
 
源代码7 项目: cortado   文件: Cortado_Tests.java
@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);
}
 
源代码8 项目: cortado   文件: Cortado_Tests.java
@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);
}
 
源代码9 项目: cortado   文件: Cortado_Tests.java
@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);
}
 
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;
}
 
源代码11 项目: morf   文件: TestDatabaseMetaDataProvider.java
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);
}
 
源代码12 项目: morf   文件: TestDatabaseMetaDataProvider.java
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());
}
 
源代码13 项目: intellijcoder   文件: TestUtil.java
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);
}
 
源代码14 项目: espresso-samples   文件: TestUtils.java
public Matcher<View> getConstraints() {
    return Matchers.allOf(new Matcher[] {
        ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed()
    });
}
 
源代码15 项目: Awesome-WanAndroid   文件: TestUtils.java
public Matcher<View> getConstraints() {
    return Matchers.allOf(new Matcher[] {
            ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed()
    });
}
 
源代码16 项目: Awesome-WanAndroid   文件: TestUtils.java
public Matcher<View> getConstraints() {
    return Matchers.allOf(new Matcher[] {
            ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed()
    });
}
 
源代码17 项目: cortado   文件: Linker.java
@Override
Matcher<? super View> link(List<Matcher<? super View>> matchers) {
    return Matchers.allOf(matchers);
}
 
源代码18 项目: java-mammoth   文件: ResultMatchers.java
public static Matcher<Result<?>> isResult(Matcher<?> valueMatcher, Iterable<String> warnings) {
    return Matchers.allOf(
        hasProperty("value", valueMatcher),
        hasWarnings(warnings));
}
 
public ViewGroupInteraction onChildView(Matcher<View> matcher) {
    //noinspection unchecked
    return new ViewGroupInteraction(Matchers.allOf(withParent(groupMatcher), matcher));
}
 
源代码20 项目: Scoops   文件: TestUtils.java
public Matcher<View> getConstraints() {
    return Matchers.allOf(new Matcher[]{
            ViewMatchers.isAssignableFrom(RecyclerView.class), ViewMatchers.isDisplayed()
    });
}