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


Java Description.appendValue方法代码示例

本文整理汇总了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);
		}
	};
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:22,代码来源:DefaultUsedJourneysTest.java

示例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);
		}
	};
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:22,代码来源:DefaultUsedJourneysTest.java

示例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;
        }
    };
}
 
开发者ID:aschattney,项目名称:dagger-test-example,代码行数:18,代码来源:SimpleEspressoTest.java

示例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);
    }
  };
}
 
开发者ID:honnix,项目名称:rkt-launcher,代码行数:15,代码来源:ApiVersionTestUtils.java

示例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);
    }
  };
}
 
开发者ID:honnix,项目名称:rkt-launcher,代码行数:15,代码来源:ApiVersionTestUtils.java

示例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);
    }
  };
}
 
开发者ID:honnix,项目名称:rkt-launcher,代码行数:15,代码来源:ApiVersionTestUtils.java

示例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);
		}
	};
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:16,代码来源:DefaultConnectionSweeperTest.java

示例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());
        }
    };
}
 
开发者ID:mvescovo,项目名称:item-reaper,代码行数:39,代码来源:CustomMatchers.java

示例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);
    }
  };
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:50,代码来源:Matchers.java

示例10: describeTo

import org.hamcrest.Description; //导入方法依赖的package包/类
@Override
public void describeTo(Description description) {
	description.appendText("ends at ");
	description.appendValue(stop);
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:6,代码来源:EndAt.java

示例11: describeTo

import org.hamcrest.Description; //导入方法依赖的package包/类
@Override
public void describeTo(Description description) {
	description.appendText("part of ");
	description.appendValue(journey);
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:6,代码来源:PartOf.java

示例12: describeMismatchSafely

import org.hamcrest.Description; //导入方法依赖的package包/类
@Override
protected void describeMismatchSafely(Connection connection, Description mismatchDescription) {
	mismatchDescription.appendText("part of ");
	mismatchDescription.appendValue(connection.journey());
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:6,代码来源:PartOf.java

示例13: describeTo

import org.hamcrest.Description; //导入方法依赖的package包/类
@Override
public void describeTo(Description description) {
	description.appendText("has id ");
	description.appendValue(id);
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:6,代码来源:HasId.java

示例14: describeMismatchSafely

import org.hamcrest.Description; //导入方法依赖的package包/类
@Override
protected void describeMismatchSafely(Connection item, Description mismatchDescription) {
	mismatchDescription.appendText("has id ");
	mismatchDescription.appendValue(item.id());
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:6,代码来源:HasId.java

示例15: describeTo

import org.hamcrest.Description; //导入方法依赖的package包/类
@Override
public void describeTo(Description description) {
	description.appendText("arrives at ");
	description.appendValue(arrival);
}
 
开发者ID:mobitopp,项目名称:connection-scan,代码行数:6,代码来源:ArriveAt.java


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