當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。