本文整理汇总了Java中org.hamcrest.core.AllOf类的典型用法代码示例。如果您正苦于以下问题:Java AllOf类的具体用法?Java AllOf怎么用?Java AllOf使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AllOf类属于org.hamcrest.core包,在下文中一共展示了AllOf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fooAllOf
import org.hamcrest.core.AllOf; //导入依赖的package包/类
public void fooAllOf() {
Espresso.onView(AllOf.allOf(ViewMatchers.withId(R.id.some_id), ViewMatchers.isDisplayed())).perform(ViewAction.click());
Espresso.onView(AllOf.allOf(ViewMatchers.withText(R.string.some_text), ViewMatchers.isDisplayed())).perform(ViewAction.click());
Espresso.onView(AllOf.allOf(ViewMatchers.withText("some text"), ViewMatchers.isDisplayed())).perform(ViewAction.click());
Espresso.onView(AllOf.allOf(RistrettoViewMatchers.with("some text"), ViewMatchers.isDisplayed())).perform(ViewAction.click());
Ristretto.withView(AllOf.allOf(ViewMatchers.withId(R.id.some_id), ViewMatchers.isDisplayed())).perform(ViewAction.click());
Ristretto.withView(AllOf.allOf(ViewMatchers.withText(R.string.some_text), ViewMatchers.isDisplayed())).perform(ViewAction.click());
Ristretto.withView(AllOf.allOf(ViewMatchers.withText("some text"), ViewMatchers.isDisplayed())).perform(ViewAction.click());
Ristretto.withView(AllOf.allOf(RistrettoViewMatchers.with("some text"), ViewMatchers.isDisplayed())).perform(ViewAction.click());
Espresso.onView(AllOf.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withId(R.id.some_id))).perform(ViewAction.click());
Espresso.onView(AllOf.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withText(R.string.some_text))).perform(ViewAction.click());
Espresso.onView(AllOf.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withText("some text"))).perform(ViewAction.click());
Espresso.onView(AllOf.allOf(ViewMatchers.isDisplayed(), RistrettoViewMatchers.with("some text"))).perform(ViewAction.click());
Ristretto.withView(AllOf.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withId(R.id.some_id))).perform(ViewAction.click());
Ristretto.withView(AllOf.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withText(R.string.some_text))).perform(ViewAction.click());
Ristretto.withView(AllOf.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withText("some text"))).perform(ViewAction.click());
Ristretto.withView(AllOf.allOf(ViewMatchers.isDisplayed(), RistrettoViewMatchers.with("some text"))).perform(ViewAction.click());
}
示例2: sendStreamMessage
import org.hamcrest.core.AllOf; //导入依赖的package包/类
@Test
public void sendStreamMessage() {
//Wait to make sure the messages are loaded
sleep(2000);
onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.scrollToHolder(withMessageHolderAndClick(MessageType.STREAM_MESSAGE, R.id.contentView)));
sleep(1000);
//Fill message EditText
ViewInteraction messageInteraction = onView(allOf(withId(R.id.message_et), isDisplayed()));
messageInteraction.perform(replaceText(testMessageStream));
//Click Send Button
ViewInteraction imageView = onView(allOf(withId(R.id.send_btn), isDisplayed()));
imageView.perform(click());
sleep(2000);
//Scroll And check the new sent message
onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.scrollToHolder(withMessageHolder(testMessageStream, R.id.contentView)));
onView(AllOf.allOf(withId(R.id.contentView), withText(testMessageStream))).check(matches(isDisplayed()));
checkIfMessagesMatchTheHeaderParent();
checkOrderOfMessagesCurrentList();
}
示例3: sendPrivateMessage
import org.hamcrest.core.AllOf; //导入依赖的package包/类
@Test
public void sendPrivateMessage() {
//Wait to make sure the messages are loaded
sleep(2000);
onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.scrollToHolder(withMessageHolderAndClick(MessageType.PRIVATE_MESSAGE, R.id.contentView)));
sleep(1000);
//Fill message EditText
ViewInteraction messageInteraction = onView(allOf(withId(R.id.message_et), isDisplayed()));
messageInteraction.perform(replaceText(testMessagePrivate));
//Click Send Button
ViewInteraction imageView = onView(allOf(withId(R.id.send_btn), isDisplayed()));
imageView.perform(click());
sleep(2000);
//Scroll And check the new sent message
onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.scrollToHolder(withMessageHolder(testMessagePrivate, R.id.contentView)));
onView(AllOf.allOf(withId(R.id.contentView), withText(testMessagePrivate))).check(matches(isDisplayed()));
checkIfMessagesMatchTheHeaderParent();
checkOrderOfMessagesCurrentList();
}
示例4: and_returns_instanceOf_AllOf
import org.hamcrest.core.AllOf; //导入依赖的package包/类
@Test
public void and_returns_instanceOf_AllOf() {
//given
List<Matcher<? super View>> matchers = new ArrayList<>();
Matcher<View> matcher = new SimpleWrappingViewMatcher<>(null);
matchers.add(matcher);
//when
Matcher<? super View> link = AND.link(matchers);
//then
assertThat(link).isInstanceOf(AllOf.class);
}
示例5: expectMessageContaining
import org.hamcrest.core.AllOf; //导入依赖的package包/类
private void expectMessageContaining(String... parts) {
List<Matcher<? super String>> matchers = new ArrayList<>();
for (String part : parts) {
matchers.add(StringContains.containsString(format(part)));
}
delegate.expectMessage(AllOf.allOf(matchers));
}
示例6: hasSameExternalValuesThan
import org.hamcrest.core.AllOf; //导入依赖的package包/类
@Factory
public static <T> Matcher<MuleMessage> hasSameExternalValuesThan(MuleMessage message) {
List<Matcher<? super MuleMessage>> allScopeMatchers = new ArrayList<Matcher<? super MuleMessage>>(3);
Object payload = message != null ? message.getPayload() : null;
allScopeMatchers.add(SamePropertiesMatcher.hasSamePropertiesThan(message));
allScopeMatchers.add(SameAttachmentsMatcher.hasSameAttachmentsThan(message));
allScopeMatchers.add(PayloadMatcher.hasPayload(payload));
return new AllOf<MuleMessage>(allScopeMatchers);
}
示例7: hasSamePropertiesThan
import org.hamcrest.core.AllOf; //导入依赖的package包/类
@Factory
public static <T> Matcher<MuleMessage> hasSamePropertiesThan(MuleMessage message) {
List<Matcher<? super MuleMessage>> allScopeMatchers = new ArrayList<Matcher<? super MuleMessage>>(4);
allScopeMatchers.add(new SamePropertiesMatcher(PropertyScope.INBOUND, message));
allScopeMatchers.add(new SamePropertiesMatcher(PropertyScope.OUTBOUND, message));
allScopeMatchers.add(new SamePropertiesMatcher(PropertyScope.INVOCATION, message));
allScopeMatchers.add(new SamePropertiesMatcher(PropertyScope.SESSION, message));
return new AllOf<MuleMessage>(allScopeMatchers);
}
示例8: hasSameAttachmentsThan
import org.hamcrest.core.AllOf; //导入依赖的package包/类
@Factory
public static <T> Matcher<MuleMessage> hasSameAttachmentsThan(MuleMessage message) {
List<Matcher<? super MuleMessage>> allScopeMatchers = new ArrayList<Matcher<? super MuleMessage>>(2);
allScopeMatchers.add(new SameAttachmentsMatcher(AttachmentScope.INBOUND, message));
allScopeMatchers.add(new SameAttachmentsMatcher(AttachmentScope.OUTBOUND, message));
return new AllOf<MuleMessage>(allScopeMatchers);
}
示例9: expectMessageContaining
import org.hamcrest.core.AllOf; //导入依赖的package包/类
private void expectMessageContaining(String... parts) {
List<Matcher<? super String>> matchers = new ArrayList<>();
for (String part : parts) {
matchers.add(StringContains.containsString(format(part)));
}
delegate.expectMessage(AllOf.allOf(matchers));
}
示例10: withNameAndBuildingFor
import org.hamcrest.core.AllOf; //导入依赖的package包/类
private Matcher<XCScheme.BuildActionEntry> withNameAndBuildingFor(
String name, Matcher<? super EnumSet<XCScheme.BuildActionEntry.BuildFor>> buildFor) {
return AllOf.allOf(
buildActionEntryWithName(name),
new FeatureMatcher<XCScheme.BuildActionEntry, EnumSet<XCScheme.BuildActionEntry.BuildFor>>(
buildFor, "Building for", "BuildFor") {
@Override
protected EnumSet<XCScheme.BuildActionEntry.BuildFor> featureValueOf(
XCScheme.BuildActionEntry entry) {
return entry.getBuildFor();
}
});
}
示例11: sameSessionDataAs
import org.hamcrest.core.AllOf; //导入依赖的package包/类
public static Matcher<Session> sameSessionDataAs(Session data) {
List<Matcher<? super Session>> matchers = new ArrayList<>();
matchers.add(sessionWithId(data.id()));
matchers.add(sessionCreatedAt(data.createdAt()));
matchers.add(sessionUpdatedAt(data.updatedAt()));
matchers.add(sessionWithMaxAge(data.maxAge()));
matchers.addAll(data.keys().stream().map(key -> sessionWithSameAttributeAs(data, key)).collect(Collectors.toList()));
return new AllOf<>(matchers);
}
示例12: allOf
import org.hamcrest.core.AllOf; //导入依赖的package包/类
/**
* Creates a matcher that matches if the examined object matches <b>ALL</b> of the specified matchers.
*/
@SafeVarargs
public static <T> OutputMatcher<T> allOf(OutputMatcher<T>... matchers) {
return OutputMatcherFactory.create(AllOf.allOf(matchers));
}
示例13: hasWarnings
import org.hamcrest.core.AllOf; //导入依赖的package包/类
public static Matcher<List<Warning>> hasWarnings(Matcher<List<Warning>>... matchers) {
return new AllOf<>(Arrays.asList(matchers));
}
示例14: reportAnd
import org.hamcrest.core.AllOf; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> T reportAnd(Object matchValuesArray, Class<T> clazz) {
List<Matcher> matchers = MatcherSyntax.matcherListFragment(clazz, matchValuesArray);
return (T) argThat(clazz, new AllOf(matchers));
}
示例15: arrayWithAll
import org.hamcrest.core.AllOf; //导入依赖的package包/类
/**
*
* Matches a non-primitive array containing elements matching the given parameters (which may be {@link MoxieMatchers} invocations).
* <p>
*
* Note that the order in which the values to be matched are specified is not significant; the array merely needs to
* contain a match for each given parameter in any order. For a matcher where ordering is significant, use {@link MoxieMatchers#array(Object[]) array()}.
* <p>
*
* @return <code>null</code>
*/
@SuppressWarnings("unchecked")
static public <T> T[] arrayWithAll(T... items) {
List<Matcher> itemMatchers = MatcherSyntax.matcherListFragment(Object.class, items);
List<Matcher> arrayMatchers = new ArrayList<Matcher>();
for (Matcher itemMatcher : itemMatchers) {
arrayMatchers.add(IsArrayContaining.hasItemInArray(itemMatcher));
}
return (T[]) argThat(Object[].class, new AllOf(arrayMatchers));
}