本文整理汇总了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);
}