org.hamcrest.Description#appendValue ( )源码实例Demo

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

public static Matcher<View> withMinimalAdapterItemCount(final int minimalCount) {
    return new TypeSafeMatcher<View>() {

        @Override
        protected boolean matchesSafely(View item) {
            //noinspection SimplifiableIfStatement - for more readable code
            if (!(item instanceof RecyclerView)) {
                return false;
            }
            return ((RecyclerView) item).getAdapter().getItemCount() >= minimalCount;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("Adapter has minimal ");
            description.appendValue(minimalCount);
            description.appendText(" items (to access requested index ");
            description.appendValue(minimalCount - 1);
            description.appendText(")");
        }
    };
}
 
@Override
public void describeTo(Description description) {
    description.appendText("with drawable from resource id: ");
    description.appendValue(resourceId);
    if (resourceName != null) {
        description.appendText("[");
        description.appendText(resourceName);
        description.appendText("]");
    }
}
 
源代码3 项目: AndroidFloatLabel   文件: FloatLabelMatchers.java
/**
 * @param floatLabelHint
 * @return View Matcher for the child EditText
 */
public static Matcher<View> withFloatLabelHint(final String floatLabelHint) {
    return new BoundedMatcher<View, EditText>(EditText.class) {

        @Override
        public void describeTo(Description description) {
            description.appendText("has floatlabel hint ");
            description.appendValue(floatLabelHint);

            if (null != floatLabelHint) {
                description.appendText("[");
                description.appendText(floatLabelHint);
                description.appendText("]");
            }

            if (null != floatLabelHint) {
                description.appendText(" value: ");
                description.appendText(floatLabelHint);
            }
        }

        @Override
        protected boolean matchesSafely(EditText editText) {
            if (!(editText instanceof EditText)) {
                return false;
            }

            String hint = ((EditText) editText).getHint().toString();

            return floatLabelHint.equals(hint);
        }
    };
}
 
源代码4 项目: p4ic4idea   文件: IgnoreFilePatternTest.java
@Override
public void describeMismatch(Object item, Description description) {
    description.appendText("was ");
    if (!(item instanceof IgnoreFilePattern.PathNameMatchResult)) {
        description.appendValue(item);
    } else {
        IgnoreFilePattern.PathNameMatchResult res = (IgnoreFilePattern.PathNameMatchResult) item;
        description.appendText("isMatch? ").appendValue(res.isMatch)
                .appendText(" requiresMore? ").appendValue(res.requiresMore)
                .appendText(" isLast? ").appendValue(res.isLastElementMatch)
                .appendText(" next ").appendValue(res.next);
    }
}
 
源代码5 项目: c5-replicator   文件: EntryEncodingUtilTest.java
private static Matcher<OLogEntryHeader> theSameMessageAs(OLogEntryHeader message) {
  return new TypeSafeMatcher<OLogEntryHeader>() {
    @Override
    public boolean matchesSafely(OLogEntryHeader item) {
      return message.getSeqNum() == item.getSeqNum()
          && message.getTerm() == item.getTerm()
          && message.getContentLength() == item.getContentLength();
    }

    @Override
    public void describeTo(Description description) {
      description.appendValue(message);
    }
  };
}
 
源代码6 项目: vics   文件: TrySuccessMatcher.java
@Override
protected void describeMismatchSafely(Try<S> item, Description mismatchDescription) {
    mismatchDescription.appendText(DESCRIPTION);
    if (item.isSuccess()) {
        mismatchDescription.appendValue(item.get());
    } else {
        mismatchDescription.appendText(" but was a Try failure");
    }
}
 
源代码7 项目: tool.accelerate.core   文件: FileContainsLines.java
@Override
public void describeMismatch(Object file, Description description) {
    List<String> lines = readLinesSafely(file, description);
    if (lines != null) {
        lineMatchingDelegate.describeMismatch(lines, description);
        description.appendText(" in file ");
        description.appendValue(file);
        description.appendText(" with lines ");
        description.appendValue(readLinesSafely(file, Description.NONE));
    }
}
 
源代码8 项目: estatio   文件: Invoice_Test.java
private Matcher<InvoiceAttributesVM> viewModelFor(final InvoiceForLease invoice) {
    return new TypeSafeMatcher<InvoiceAttributesVM>() {
        @Override protected boolean matchesSafely(final InvoiceAttributesVM invoiceAttributesVM) {
            return invoiceAttributesVM.getInvoice() == invoice;
        }

        @Override public void describeTo(final Description description) {
            description.appendValue("is view model wrapping " + invoice);
        }
    };
}
 
源代码9 项目: jtwig-core   文件: IsOptional.java
@Override
public void describeTo(Description description) {
    if (!someExpected) {
        description.appendText("<Absent>");
    } else if (expected.isPresent()) {
        description.appendValue(expected);// "a Some with " +
        // expected.some());
    } else if (matcher.isPresent()) {
        description.appendText("a present value matching ");
        matcher.get().describeTo(description);
    } else {
        description.appendText("<Present>");
    }
}
 
源代码10 项目: morphia   文件: JSONMatcher.java
@Override
public void describeTo(final Description description) {
    try {
        Object expectedJsonAsPrettyJson = JSONParser.parseJSON(expectedJson);
        description.appendValue(expectedJsonAsPrettyJson);
    } catch (final JSONException e) {
        throw new RuntimeException(String.format("Error parsing expected JSON string %s. Got Exception %s",
                                                 expectedJson, e.toString()));
    }
}
 
源代码11 项目: flink   文件: TtlValueMatchers.java
@Override
protected boolean matchesSafely(TtlValue<T> item, Description mismatchDescription) {
	mismatchDescription.appendText("TtlValue with value ");
	mismatchDescription.appendValue(item.getUserValue());
	mismatchDescription.appendText(" with timestamp ");
	mismatchDescription.appendValue(item.getLastAccessTimestamp());
	return valueMatcher.matches(item.getUserValue()) &&
			timestampMatcher.matches(item.getLastAccessTimestamp());
}
 
源代码12 项目: concurrentlinkedhashmap   文件: IsReserializable.java
@Override
public void describeTo(Description description) {
  description.appendValue("serialized clone");
}
 
源代码13 项目: jenkins-test-harness   文件: JenkinsMatchers.java
public void describeTo(Description description) {
    description.appendText("has a symmetric equals(Object) method with ");
    description.appendValue(other);
}
 
源代码14 项目: flink   文件: DeserializationSchemaMatcher.java
@Override
public void describeTo(Description description) {
	description.appendValue(expected);
}
 
源代码15 项目: confluence-publisher   文件: SameJsonAsMatcher.java
@Override
public void describeTo(Description description) {
    description.appendValue(this.expectedJson);
}
 
源代码16 项目: c5-replicator   文件: FutureActions.java
public void describeTo(Description description) {
  description.appendText("returns a future with exception ");
  description.appendValue(exception);
}
 
源代码17 项目: kogito-runtimes   文件: BinaryHeapQueueTest.java
public void describeTo(Description description) {
    description.appendValue( expected );
}
 
源代码18 项目: c5-replicator   文件: FutureActions.java
public void describeTo(Description description) {
  description.appendText("returns a future with value ");
  description.appendValue(futureResult);
}
 
源代码19 项目: jenkins-test-harness   文件: JenkinsMatchers.java
public void describeTo(Description description) {
    description.appendText("follows the hashCode contract when compared to ");
    description.appendValue(other);
}
 
源代码20 项目: prebid-mobile-android   文件: ViewMinSizeMatcher.java
@Override
public void describeTo(Description description) {
    description.appendText("with MinSizeMatcher: ");
    description.appendValue(expectedMinWith + "x" + expectedMinHeight);
}