Package org.dmfs.jems2.hamcrest.matchers
Class ParallelMatcher<T>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeDiagnosingMatcher<T>
org.dmfs.jems2.hamcrest.matchers.ParallelMatcher<T>
- All Implemented Interfaces:
org.hamcrest.Matcher<T>,org.hamcrest.SelfDescribing
public final class ParallelMatcher<T>
extends org.hamcrest.TypeSafeDiagnosingMatcher<T>
A
Matcher which runs another matcher multiple times in concurrent threads. This can help in finding potential race conditions and other concurrency
issues. However, due to the nature of such issues there is no guarantee that all, if any, existing issues will be reported. So take the results with a grain
of salt.
Note, when running time consuming tests make sure you reduce the number of threads to ensure the test will terminate in a timely manner.
Also note, due to the way hamcrest matchers work and the nature of concurrency issues, this test can not report the mismatch description of a failing matcher.
-
Constructor Summary
ConstructorsConstructorDescriptionParallelMatcher(int threads, org.hamcrest.Matcher<T> delegate) ParallelMatcher(org.hamcrest.Matcher<T> delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoiddescribeTo(org.hamcrest.Description description) protected booleanmatchesSafely(T item, org.hamcrest.Description mismatchDescription) static <T> org.hamcrest.Matcher<T>parallel(int threads, org.hamcrest.Matcher<T> delegate) static <T> org.hamcrest.Matcher<T>parallel(org.hamcrest.Matcher<T> delegate) Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matchesMethods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
-
Constructor Details
-
ParallelMatcher
-
ParallelMatcher
-
-
Method Details
-
parallel
public static <T> org.hamcrest.Matcher<T> parallel(int threads, org.hamcrest.Matcher<T> delegate) -
parallel
public static <T> org.hamcrest.Matcher<T> parallel(org.hamcrest.Matcher<T> delegate) -
matchesSafely
- Specified by:
matchesSafelyin classorg.hamcrest.TypeSafeDiagnosingMatcher<T>
-
describeTo
public void describeTo(org.hamcrest.Description description)
-