下面列出了org.hamcrest.Matchers#anything ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public static <T> Matcher<WindowedValue<? extends T>> isWindowedValue(
Matcher<? super T> valueMatcher,
Matcher<? super Instant> timestampMatcher,
Matcher<? super Collection<? extends BoundedWindow>> windowsMatcher) {
return new WindowedValueMatcher<>(
valueMatcher, timestampMatcher, windowsMatcher, Matchers.anything());
}
public static <T> Matcher<WindowedValue<? extends T>> isSingleWindowedValue(
Matcher<? super T> valueMatcher,
Matcher<? super Instant> timestampMatcher,
Matcher<? super BoundedWindow> windowMatcher) {
return new WindowedValueMatcher<>(
valueMatcher, timestampMatcher, Matchers.contains(windowMatcher), Matchers.anything());
}
@Test
public void shouldMatchVisibleElements() {
VisibleText<Text> matcher = new VisibleText<>(Matchers.anything());
Text mockText = mock(Text.class);
when(mockText.isDisplayed()).thenReturn(true);
assertTrue(matcher.matches(mockText));
}
@Test
public void shouldNotMatchNotVisibleElements() {
VisibleText<Text> matcher = new VisibleText<>(Matchers.anything());
Text mockText = mock(Text.class);
when(mockText.isDisplayed()).thenReturn(false);
assertFalse(matcher.matches(mockText));
}
public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
Matcher<? super T> valueMatcher) {
return new StreamRecordMatcher<>(valueMatcher, Matchers.anything());
}
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());
}
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
Matcher<? super T> valueMatcher) {
return new WindowedValueMatcher<>(valueMatcher, Matchers.anything(), Matchers.anything());
}
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
Matcher<? super T> valueMatcher, Matcher<? super Long> timestampMatcher) {
return new WindowedValueMatcher<>(valueMatcher, timestampMatcher, Matchers.anything());
}
public static <T> Matcher<StreamRecord<? extends T>> isStreamRecord(
Matcher<? super T> valueMatcher) {
return new StreamRecordMatcher<>(valueMatcher, Matchers.anything());
}
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());
}
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
Matcher<? super T> valueMatcher) {
return new WindowedValueMatcher<>(valueMatcher, Matchers.anything(), Matchers.anything());
}
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
Matcher<? super T> valueMatcher, Matcher<? super Long> timestampMatcher) {
return new WindowedValueMatcher<>(valueMatcher, timestampMatcher, Matchers.anything());
}
public static <T> Matcher<WindowedValue<? extends T>> isWindowedValue(
Matcher<? super T> valueMatcher, Matcher<? super Instant> timestampMatcher) {
return new WindowedValueMatcher<>(
valueMatcher, timestampMatcher, Matchers.anything(), Matchers.anything());
}
public static <T> Matcher<WindowedValue<? extends T>> isWindowedValue(
Matcher<? super T> valueMatcher) {
return new WindowedValueMatcher<>(
valueMatcher, Matchers.anything(), Matchers.anything(), Matchers.anything());
}
@Override
public Matcher<View> getConstraints() {
return Matchers.anything();
}
public static <T> Matcher<StreamRecord<? extends T>> streamRecord(
Matcher<? super T> valueMatcher) {
return new StreamRecordMatcher<>(valueMatcher, Matchers.anything());
}
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());
}
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
Matcher<? super T> valueMatcher) {
return new WindowedValueMatcher<>(valueMatcher, Matchers.anything(), Matchers.anything());
}
public static <T, W extends Window> Matcher<StreamRecord<? extends WindowedValue<? extends T, ? extends W>>> isWindowedValue(
Matcher<? super T> valueMatcher, Matcher<? super Long> timestampMatcher) {
return new WindowedValueMatcher<>(valueMatcher, timestampMatcher, Matchers.anything());
}