Java Code Examples for org.mockito.Mockito#argThat()
The following examples show how to use
org.mockito.Mockito#argThat() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Nicobar File: ScriptModuleLoaderTest.java License: Apache License 2.0 | 7 votes |
/** * Custom mockito/hamcrest matcher which will inspect a ScriptModule and see if its moduleId * equals the input moduleId and likewise for the creation time */ private ScriptModule moduleEquals(final String scriptModuleId, final long createTime) { return Mockito.argThat(new ArgumentMatcher<ScriptModule>() { @Override public boolean matches(Object argument) { ScriptModule scriptModule = (ScriptModule)argument; return scriptModule != null && scriptModule.getModuleId().toString().equals(scriptModuleId) && scriptModule.getCreateTime() == createTime; } @Override public void describeTo(Description description) { description.appendText("ScriptModule.getModuleId().equals(\"" + scriptModuleId + "\")"); } }); }
Example 2
Source Project: hadoop File: TestCheckpoint.java License: Apache License 2.0 | 5 votes |
private File filePathContaining(final String substring) { return Mockito.argThat( new ArgumentMatcher<File>() { @Override public boolean matches(Object argument) { String path = ((File) argument).getAbsolutePath(); return path.contains(substring); } }); }
Example 3
Source Project: big-c File: TestCheckpoint.java License: Apache License 2.0 | 5 votes |
private File filePathContaining(final String substring) { return Mockito.argThat( new ArgumentMatcher<File>() { @Override public boolean matches(Object argument) { String path = ((File) argument).getAbsolutePath(); return path.contains(substring); } }); }
Example 4
Source Project: mobile-messaging-sdk-android File: MobileMessagingCloudServiceTest.java License: Apache License 2.0 | 5 votes |
private static Intent intentWith(final Message message) { return Mockito.argThat(new ArgumentMatcher<Intent>() { @Override public boolean matches(Object o) { Intent intent = (Intent) o; Message that = Message.createFrom(intent.getExtras()); return message.getBody().equals(that.getBody()) && message.getMessageId().equals(that.getMessageId()); } }); }
Example 5
Source Project: mobile-messaging-sdk-android File: MobileMessagingCloudServiceTest.java License: Apache License 2.0 | 5 votes |
@SuppressWarnings("SameParameterValue") private static Intent intentWith(final String senderId) { return Mockito.argThat(new ArgumentMatcher<Intent>() { @Override public boolean matches(Object o) { Intent intent = (Intent) o; return senderId.equals(intent.getStringExtra(MobileMessagingCloudHandler.EXTRA_SENDER_ID)); } }); }
Example 6
Source Project: mobile-messaging-sdk-android File: MobileMessagingCloudServiceTest.java License: Apache License 2.0 | 5 votes |
@SuppressWarnings("SameParameterValue") private static Intent intentWith(final String senderId, final String token) { return Mockito.argThat(new ArgumentMatcher<Intent>() { @Override public boolean matches(Object o) { Intent intent = (Intent) o; return senderId.equals(intent.getStringExtra(MobileMessagingCloudHandler.EXTRA_SENDER_ID)) && token.equals(intent.getStringExtra(MobileMessagingCloudHandler.EXTRA_TOKEN)); } }); }
Example 7
Source Project: vertx-vaadin File: VertxVaadinResponseUT.java License: MIT License | 4 votes |
private static String caseInsensitive(String arg) { return Mockito.argThat(new CaseInsensitiveEquals(arg)); }
Example 8
Source Project: vertx-vaadin File: VertxVaadinResponseUT.java License: MIT License | 4 votes |
private static String caseInsensitive(String arg) { return Mockito.argThat(new CaseInsensitiveEquals(arg)); }
Example 9
Source Project: mockito-java8 File: AssertionMatcher.java License: Apache License 2.0 | 4 votes |
@SuppressWarnings("ResultOfMethodCallIgnored") private static <T> void argThat(Consumer<T> consumer) { Mockito.argThat(new AssertionMatcher<>(consumer)); }
Example 10
Source Project: joynr File: MockitoTestUtils.java License: Apache License 2.0 | 4 votes |
public static HttpRequest anyPerformanceHttpRequest(final String bpId, int activeLongPolls, int assignedChannels) { return Mockito.argThat(new IsAnyPerformanceHttpRequest(bpId, activeLongPolls, assignedChannels)); }