本文整理匯總了Java中org.hamcrest.Description.appendValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Description.appendValue方法的具體用法?Java Description.appendValue怎麽用?Java Description.appendValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.hamcrest.Description
的用法示例。
在下文中一共展示了Description.appendValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: used
import org.hamcrest.Description; //導入方法依賴的package包/類
private static Matcher<UsedJourneys> used(Journey journey) {
return new TypeSafeMatcher<UsedJourneys>() {
@Override
public void describeTo(Description description) {
description.appendText("used");
description.appendValue(journey);
}
@Override
protected boolean matchesSafely(UsedJourneys journeys) {
return journeys.used(journey);
}
@Override
protected void describeMismatchSafely(UsedJourneys item, Description mismatchDescription) {
mismatchDescription.appendText("not used");
mismatchDescription.appendValue(journey);
}
};
}
示例2: notUsed
import org.hamcrest.Description; //導入方法依賴的package包/類
private static Matcher<UsedJourneys> notUsed(Journey journey) {
return new TypeSafeMatcher<UsedJourneys>() {
@Override
public void describeTo(Description description) {
description.appendText("not used");
description.appendValue(journey);
}
@Override
protected boolean matchesSafely(UsedJourneys journeys) {
return !journeys.used(journey);
}
@Override
protected void describeMismatchSafely(UsedJourneys item, Description mismatchDescription) {
mismatchDescription.appendText("used");
mismatchDescription.appendValue(journey);
}
};
}
示例3: withIndex
import org.hamcrest.Description; //導入方法依賴的package包/類
private static Matcher<View> withIndex(final Matcher<View> matcher, final int index) {
return new TypeSafeMatcher<View>() {
int currentIndex = 0;
@Override
public void describeTo(Description description) {
description.appendText("with index: ");
description.appendValue(index);
matcher.describeTo(description);
}
@Override
public boolean matchesSafely(View view) {
return matcher.matches(view) && currentIndex++ == index;
}
};
}
示例4: isAtLeast
import org.hamcrest.Description; //導入方法依賴的package包/類
static Matcher<Api.Version> isAtLeast(final Api.Version lowerBound) {
return new TypeSafeMatcher<Api.Version>() {
@Override
protected boolean matchesSafely(final Api.Version item) {
return item.ordinal() >= lowerBound.ordinal();
}
@Override
public void describeTo(final Description description) {
description.appendText("Version is at least");
description.appendValue(lowerBound);
}
};
}
示例5: isAtMost
import org.hamcrest.Description; //導入方法依賴的package包/類
static Matcher<Api.Version> isAtMost(final Api.Version upperBound) {
return new TypeSafeMatcher<Api.Version>() {
@Override
protected boolean matchesSafely(final Api.Version item) {
return item.ordinal() <= upperBound.ordinal();
}
@Override
public void describeTo(final Description description) {
description.appendText("Version is at most");
description.appendValue(upperBound);
}
};
}
示例6: is
import org.hamcrest.Description; //導入方法依賴的package包/類
static Matcher<Api.Version> is(final Api.Version version) {
return new TypeSafeMatcher<Api.Version>() {
@Override
protected boolean matchesSafely(final Api.Version item) {
return item.ordinal() == version.ordinal();
}
@Override
public void describeTo(final Description description) {
description.appendText("Version can only be");
description.appendValue(version);
}
};
}
示例7: afterLatestDeparture
import org.hamcrest.Description; //導入方法依賴的package包/類
private static Matcher<DefaultConnectionSweeper> afterLatestDeparture(Time time) {
return new TypeSafeMatcher<DefaultConnectionSweeper>() {
@Override
public void describeTo(Description description) {
description.appendValue(time);
description.appendText("too late");
}
@Override
protected boolean matchesSafely(DefaultConnectionSweeper connections) {
return connections.areDepartedBefore(time);
}
};
}
示例8: withTextInputLayoutHint
import org.hamcrest.Description; //導入方法依賴的package包/類
public static Matcher<View> withTextInputLayoutHint(final int resourceId) {
return new BoundedMatcher<View, TextInputLayout>(TextInputLayout.class) {
private String resourceName = null;
private String expectedText = null;
@Override
public void describeTo(Description description) {
description.appendText("with string from resource id: ");
description.appendValue(resourceId);
if (null != resourceName) {
description.appendText("[");
description.appendText(resourceName);
description.appendText("]");
}
if (null != expectedText) {
description.appendText(" value: ");
description.appendText(expectedText);
}
}
@Override
public boolean matchesSafely(TextInputLayout textInputLayout) {
if (null == expectedText) {
try {
expectedText = textInputLayout.getResources().getString(resourceId);
resourceName = textInputLayout.getResources()
.getResourceEntryName(resourceId);
} catch (Resources.NotFoundException ignored) {
/* view could be from a context unaware of the resource id. */
}
}
CharSequence actualText = textInputLayout.getHint();
// FYI: actualText may not be string ... its just a char sequence convert to string.
return null != expectedText && null != actualText
&& expectedText.equals(actualText.toString());
}
};
}
示例9: equalTo
import org.hamcrest.Description; //導入方法依賴的package包/類
/**
* Gets a hamcrest matcher that tests whether two Ini objects are equal.
*
* @param expectedValue
* The expected value to core against.
* @return Method safe matcher that will core field equality.
*/
@Factory
public static TypeSafeMatcher<Ini> equalTo(final Ini expectedValue) {
return new TypeSafeMatcher<Ini>() {
@Override
protected boolean matchesSafely(Ini actualValue) {
if (expectedValue.size() != actualValue.size()) {
return false;
}
for (Section expectedSection : expectedValue.values()) {
Section actualSection = actualValue.get(expectedSection.getName());
if (actualSection == null) {
return false;
}
if (expectedSection.size() != actualSection.size()) {
return false;
}
for (Entry<String,String> expectedEntry : expectedSection.entrySet()) {
if (!actualSection.containsKey(expectedEntry.getKey())) {
return false;
}
String actual = actualSection.get(expectedEntry.getKey());
String expected = expectedEntry.getValue();
if ((actual == null && expected != null) || (actual != null && !actual.equals(expected))) {
return false;
}
}
}
return true;
}
@Override
public void describeTo(Description description) {
description.appendValue(expectedValue);
}
};
}
示例10: describeTo
import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
public void describeTo(Description description) {
description.appendText("ends at ");
description.appendValue(stop);
}
示例11: describeTo
import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
public void describeTo(Description description) {
description.appendText("part of ");
description.appendValue(journey);
}
示例12: describeMismatchSafely
import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
protected void describeMismatchSafely(Connection connection, Description mismatchDescription) {
mismatchDescription.appendText("part of ");
mismatchDescription.appendValue(connection.journey());
}
示例13: describeTo
import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
public void describeTo(Description description) {
description.appendText("has id ");
description.appendValue(id);
}
示例14: describeMismatchSafely
import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
protected void describeMismatchSafely(Connection item, Description mismatchDescription) {
mismatchDescription.appendText("has id ");
mismatchDescription.appendValue(item.id());
}
示例15: describeTo
import org.hamcrest.Description; //導入方法依賴的package包/類
@Override
public void describeTo(Description description) {
description.appendText("arrives at ");
description.appendValue(arrival);
}