You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2017/08/02 17:12:45 UTC
isis git commit: ISIS-1686: minor reworking of matchers in
IntegrationTestAbstract2
Repository: isis
Updated Branches:
refs/heads/master 9a2702c3d -> a8ee04b7e
ISIS-1686: minor reworking of matchers in IntegrationTestAbstract2
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/a8ee04b7
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/a8ee04b7
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/a8ee04b7
Branch: refs/heads/master
Commit: a8ee04b7ee800e5c66f8d6eb9b3644ee046bc334
Parents: 9a2702c
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 2 18:12:40 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 2 18:12:40 2017 +0100
----------------------------------------------------------------------
.../IntegrationTestAbstract2.java | 20 ++------------
.../integtestsupport/ThrowableMatchers.java | 29 ++++++++++++++++++++
2 files changed, 31 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/a8ee04b7/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IntegrationTestAbstract2.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IntegrationTestAbstract2.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IntegrationTestAbstract2.java
index 6f50644..9f382cd 100644
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IntegrationTestAbstract2.java
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IntegrationTestAbstract2.java
@@ -18,14 +18,8 @@
*/
package org.apache.isis.core.integtestsupport;
-import java.util.List;
-
import javax.inject.Inject;
-import com.google.common.base.Throwables;
-import com.google.common.collect.FluentIterable;
-
-import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -92,18 +86,8 @@ public abstract class IntegrationTestAbstract2 extends IntegrationTestAbstract {
nextTransaction();
}
- protected static TypeSafeMatcher<Throwable> of(final Class<?> type) {
- return new TypeSafeMatcher<Throwable>() {
- @Override
- protected boolean matchesSafely(final Throwable throwable) {
- final List<Throwable> causalChain = Throwables.getCausalChain(throwable);
- return !FluentIterable.from(causalChain).filter(type).isEmpty();
- }
-
- @Override public void describeTo(final Description description) {
- description.appendText("Caused by " + type.getName());
- }
- };
+ protected static TypeSafeMatcher<Throwable> causedBy(final Class<?> type) {
+ return ThrowableMatchers.causedBy(type);
}
@Inject
http://git-wip-us.apache.org/repos/asf/isis/blob/a8ee04b7/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/ThrowableMatchers.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/ThrowableMatchers.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/ThrowableMatchers.java
new file mode 100644
index 0000000..8527cac
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/ThrowableMatchers.java
@@ -0,0 +1,29 @@
+package org.apache.isis.core.integtestsupport;
+
+import java.util.List;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.FluentIterable;
+
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeMatcher;
+
+public class ThrowableMatchers {
+
+ ThrowableMatchers(){}
+
+ public static TypeSafeMatcher<Throwable> causedBy(final Class<?> type) {
+ return new TypeSafeMatcher<Throwable>() {
+ @Override
+ protected boolean matchesSafely(final Throwable throwable) {
+ final List<Throwable> causalChain = Throwables.getCausalChain(throwable);
+ return !FluentIterable.from(causalChain).filter(type).isEmpty();
+ }
+
+ @Override public void describeTo(final Description description) {
+ description.appendText("Caused by " + type.getName());
+ }
+ };
+ }
+
+}