org.hamcrest.Matchers#equalTo ( )源码实例Demo

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

源代码1 项目: cactoos   文件: InputStreamOfTest.java
@Test
public void readsFromCharSequenceWithCharsetName() throws Exception {
    final String content = "Simple content";
    new Assertion<>(
        "Can't read from char sequence with charset name",
        new TextOf(
            new InputStreamOf(
                content,
                StandardCharsets.UTF_8.name()
            )
        ).asString(),
        Matchers.equalTo(content)
    );
}
 
源代码2 项目: helios   文件: HeliosClientTest.java
/** A Matcher that tests that the URI has a path equal to the given path. */
private static Matcher<URI> hasPath(final String path) {
  return new FeatureMatcher<URI, String>(Matchers.equalTo(path), "path", "path") {
    @Override
    protected String featureValueOf(final URI actual) {
      return actual.getPath();
    }
  };
}
 
源代码3 项目: cactoos   文件: InputStreamOfTest.java
@Test
public void readsFromCharSequenceWithCharset() throws Exception {
    final String content = "Another simple content";
    new Assertion<>(
        "Can't read from char sequence with charset",
        new TextOf(
            new InputStreamOf(
                content,
                StandardCharsets.UTF_8
            )
        ).asString(),
        Matchers.equalTo(content)
    );
}
 
源代码4 项目: cactoos   文件: InputStreamOfTest.java
@Test
public void readsFileContent() throws Exception {
    final File file = this.folder.newFile("readFileContent.txt-2");
    final String content = "Content in a file";
    new LengthOf(
        new TeeInput(content, file)
    ).intValue();
    new Assertion<>(
        "Can't read from file",
        new TextOf(new InputStreamOf(file)).asString(),
        Matchers.equalTo(content)
    );
}
 
源代码5 项目: java-mammoth   文件: DeepReflectionMatcher.java
private static <T> boolean matchesPrimitive(String path, T expected, T actual, Description mismatchDescription) {
    Matcher<Object> matcher = Matchers.equalTo(expected);
    if (!matcher.matches(actual)) {
        appendPath(mismatchDescription, path);
        matcher.describeMismatch(actual, mismatchDescription);
        return false;
    } else {
        return true;
    }
}
 
源代码6 项目: cactoos   文件: InputStreamOfTest.java
@Test
public void readsBytesArray() throws Exception {
    final String content = "Bytes array content";
    final byte[] bytes = new BytesOf(content).asBytes();
    new Assertion<>(
        "Can't read from byte array",
        new TextOf(new InputStreamOf(bytes)).asString(),
        Matchers.equalTo(content)
    );
}
 
源代码7 项目: cactoos   文件: InputStreamOfTest.java
@Test
public void readsFromReaderWithCharsetWithMax() throws Exception {
    final String content = "Reading with charset and buffer size";
    new Assertion<>(
        "Can't read from reader with charset and buffer size",
        new TextOf(
            new InputStreamOf(
                new StringReader(content),
                StandardCharsets.UTF_8,
                1
            )
        ).asString(),
        Matchers.equalTo(content)
    );
}
 
源代码8 项目: Flink-CEPplus   文件: StreamRecordMatchers.java
public static Matcher<TimeWindow> timeWindow(long start, long end) {
	return Matchers.equalTo(new TimeWindow(start, end));
}
 
源代码9 项目: Flink-CEPplus   文件: StreamRecordMatchers.java
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
	Matcher<? super T> valueMatcher, long timestamp) {
	return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), Matchers.anything());
}
 
源代码10 项目: Flink-CEPplus   文件: StreamRecordMatchers.java
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
	Matcher<? super T> valueMatcher, long timestamp, W window) {
	return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), Matchers.equalTo(window));
}
 
源代码11 项目: Flink-CEPplus   文件: StreamRecordMatchers.java
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
	Matcher<? super T> valueMatcher, long timestamp, Matcher<? super W> windowMatcher) {
	return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), windowMatcher);
}
 
源代码12 项目: flink   文件: StreamRecordMatchers.java
public static Matcher<TimeWindow> timeWindow(long start, long end) {
	return Matchers.equalTo(new TimeWindow(start, end));
}
 
源代码13 项目: flink   文件: StreamRecordMatchers.java
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
	Matcher<? super T> valueMatcher, long timestamp, Matcher<? super W> windowMatcher) {
	return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), windowMatcher);
}
 
源代码14 项目: fdb-record-layer   文件: PredicateMatchers.java
public static Matcher<QueryPredicate> equivalentTo(@Nonnull QueryComponent component) {
    return Matchers.equalTo(component.normalizeForPlanner(BlankSource.INSTANCE));
}
 
源代码15 项目: fdb-record-layer   文件: ElementMatcher.java
@Nonnull
public ElementPredicateMatcher equalsValue(@Nonnull Object comparand) {
    return new ElementPredicateMatcher(this,
            Matchers.equalTo(new Comparisons.SimpleComparison(Comparisons.Type.EQUALS, comparand)));
}
 
源代码16 项目: fdb-record-layer   文件: ElementMatcher.java
@Nonnull
public ElementPredicateMatcher notEquals(@Nonnull Object comparand) {
    return new ElementPredicateMatcher(this,
            Matchers.equalTo(new Comparisons.SimpleComparison(Comparisons.Type.NOT_EQUALS, comparand)));
}
 
源代码17 项目: flink   文件: StreamRecordMatchers.java
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
	Matcher<? super T> valueMatcher, long timestamp, W window) {
	return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), Matchers.equalTo(window));
}
 
源代码18 项目: flink   文件: StreamRecordMatchers.java
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
	Matcher<? super T> valueMatcher, long timestamp, Matcher<? super W> windowMatcher) {
	return new WindowedValueMatcher<>(valueMatcher, Matchers.equalTo(timestamp), windowMatcher);
}
 
源代码19 项目: takes   文件: HmRqTextBody.java
/**
 * Ctor with equalTo matcher and default charset.
 * @param expected String to test against
 */
public HmRqTextBody(final String expected) {
    this(Matchers.equalTo(expected));
}
 
源代码20 项目: takes   文件: HmRsStatus.java
/**
 * Create matcher using HTTP code.
 * @param val HTTP code value
 * @since 0.17
 */
public HmRsStatus(final int val) {
    this(Matchers.equalTo(val));
}