当前位置: 首页>>代码示例>>Java>>正文


Java StringDescription.appendText方法代码示例

本文整理汇总了Java中org.hamcrest.StringDescription.appendText方法的典型用法代码示例。如果您正苦于以下问题:Java StringDescription.appendText方法的具体用法?Java StringDescription.appendText怎么用?Java StringDescription.appendText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hamcrest.StringDescription的用法示例。


在下文中一共展示了StringDescription.appendText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: check

import org.hamcrest.StringDescription; //导入方法依赖的package包/类
@Override
public void check(View view, NoMatchingViewException noViewFoundException) {
  StringDescription description = new StringDescription();
  RecyclerView recyclerView = (RecyclerView) view;
  sortedList = withAdapter.itemsToSort(recyclerView);

  checkIsNotEmpty(view, description);

  description.appendText("The list " + sortedList + " is not sorted");
  assertTrue(description.toString(), Ordering.natural().<T>isOrdered(sortedList));
}
 
开发者ID:tonilopezmr,项目名称:Game-of-Thrones,代码行数:12,代码来源:RecyclerSortedViewAssertion.java

示例2: checkIsNotEmpty

import org.hamcrest.StringDescription; //导入方法依赖的package包/类
private void checkIsNotEmpty(View view, StringDescription description) {
  if (sortedList.isEmpty()) {
    description.appendText("The list must be not empty");
    throw (new PerformException.Builder())
        .withActionDescription(description.toString())
        .withViewDescription(HumanReadables.describe(view))
        .withCause(new IllegalStateException("The list is empty"))
        .build();
  }
}
 
开发者ID:tonilopezmr,项目名称:Game-of-Thrones,代码行数:11,代码来源:RecyclerSortedViewAssertion.java

示例3: testIndentDescription

import org.hamcrest.StringDescription; //导入方法依赖的package包/类
@Test
public void testIndentDescription() throws Exception {
  StringDescription innerDescription = new StringDescription();
  innerDescription.appendText("a\nb");

  StringDescription description = new StringDescription();
  DescriptionUtils.indentDescription(description, innerDescription);

  assertThat(description.toString(), is("a\n  b\n"));
}
 
开发者ID:spotify,项目名称:java-hamcrest,代码行数:11,代码来源:DescriptionUtilsTest.java

示例4: testIndentDescriptionNoExtraNewline

import org.hamcrest.StringDescription; //导入方法依赖的package包/类
@Test
public void testIndentDescriptionNoExtraNewline() throws Exception {
  StringDescription innerDescription = new StringDescription();
  innerDescription.appendText("a\nb\n");

  StringDescription description = new StringDescription();
  DescriptionUtils.indentDescription(description, innerDescription);

  assertThat(description.toString(), is("a\n  b\n"));
}
 
开发者ID:spotify,项目名称:java-hamcrest,代码行数:11,代码来源:DescriptionUtilsTest.java

示例5: dispatch

import org.hamcrest.StringDescription; //导入方法依赖的package包/类
@Override
public MockResponse dispatch(RecordedRequest request) throws InterruptedException {
    for (Map.Entry<Matcher<RecordedRequest>, MockResponse> response : responses.entrySet()) {
        Matcher<RecordedRequest> requestMatcher = response.getKey();
        if (requestMatcher.matches(request)) {
            return response.getValue();
        } else {
            StringDescription description = new StringDescription();
            description.appendText("Did not match request");
            requestMatcher.describeMismatch(request, description);
            Log.v(MatchingDispatcher.class.getName(), description.toString());
        }
    }
    return new MockResponse().setResponseCode(500);
}
 
开发者ID:savvasdalkitsis,项目名称:Mondo,代码行数:16,代码来源:MatchingDispatcher.java

示例6: check

import org.hamcrest.StringDescription; //导入方法依赖的package包/类
@Override
public void check(View view, NoMatchingViewException noViewFoundException) {
    StringDescription description = new StringDescription();
    RecyclerView recyclerView = (RecyclerView) view;
    sortedList = withAdapter.itemsToSort(recyclerView);

    checkIsNotEmpty(view, description);

    description.appendText("The list "+ sortedList + " is not sorted");
    assertTrue(description.toString(), Ordering.natural().<T>isOrdered(sortedList));
}
 
开发者ID:srgtrujillo,项目名称:quotes,代码行数:12,代码来源:RecyclerSortedViewAssertion.java

示例7: checkIsNotEmpty

import org.hamcrest.StringDescription; //导入方法依赖的package包/类
private void checkIsNotEmpty(View view, StringDescription description) {
    if (sortedList.isEmpty()) {
        description.appendText("The list must be not null");
        throw (new PerformException.Builder())
                .withActionDescription(description.toString())
                .withViewDescription(HumanReadables.describe(view))
                .withCause(new IllegalStateException("The list is empty"))
                .build();
    }
}
 
开发者ID:srgtrujillo,项目名称:quotes,代码行数:11,代码来源:RecyclerSortedViewAssertion.java

示例8: verifyNoAbandoned

import org.hamcrest.StringDescription; //导入方法依赖的package包/类
private boolean verifyNoAbandoned(
    final ApiSurface checkedApiSurface,
    final Set<Matcher<Class<?>>> allowedClasses,
    final Description mismatchDescription) {

  // <helper_lambdas>

  final Function<Matcher<Class<?>>, String> toMessage =
      new Function<Matcher<Class<?>>, String>() {

        @Override
        public String apply(@Nonnull final Matcher<Class<?>> abandonedClassMacther) {
          final StringDescription description = new StringDescription();
          description.appendText("No ");
          abandonedClassMacther.describeTo(description);
          return description.toString();
        }
      };

  final Predicate<Matcher<Class<?>>> matchedByExposedClasses =
      new Predicate<Matcher<Class<?>>>() {

        @Override
        public boolean apply(@Nonnull final Matcher<Class<?>> classMatcher) {
          return FluentIterable.from(checkedApiSurface.getExposedClasses())
              .anyMatch(
                  new Predicate<Class<?>>() {

                    @Override
                    public boolean apply(@Nonnull final Class<?> aClass) {
                      return classMatcher.matches(aClass);
                    }
                  });
        }
      };

  // </helper_lambdas>

  final ImmutableSet<Matcher<Class<?>>> matchedClassMatchers =
      FluentIterable.from(allowedClasses).filter(matchedByExposedClasses).toSet();

  final Sets.SetView<Matcher<Class<?>>> abandonedClassMatchers =
      Sets.difference(allowedClasses, matchedClassMatchers);

  final ImmutableList<String> messages =
      FluentIterable.from(abandonedClassMatchers)
          .transform(toMessage)
          .toSortedList(Ordering.<String>natural());

  if (!messages.isEmpty()) {
    mismatchDescription.appendText(
        "The following white-listed scopes did not have matching classes on the API surface:"
            + "\n\t"
            + Joiner.on("\n\t").join(messages));
  }

  return messages.isEmpty();
}
 
开发者ID:apache,项目名称:beam,代码行数:59,代码来源:ApiSurface.java


注:本文中的org.hamcrest.StringDescription.appendText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。