You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2015/04/04 16:39:07 UTC
camel git commit: Remove TestSupport#assertThrowable() utility as it
doesn't bring any added functionality compared to
TestSupport#assertIsInstanceOf().
Repository: camel
Updated Branches:
refs/heads/master 05731d305 -> 2b9ccadf8
Remove TestSupport#assertThrowable() utility as it doesn't bring any added functionality compared to TestSupport#assertIsInstanceOf().
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2b9ccadf
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2b9ccadf
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2b9ccadf
Branch: refs/heads/master
Commit: 2b9ccadf846b666411dc2fddaad0e75c0ced0386
Parents: 05731d3
Author: Babak Vahdat <bv...@apache.org>
Authored: Sat Apr 4 16:38:41 2015 +0200
Committer: Babak Vahdat <bv...@apache.org>
Committed: Sat Apr 4 16:38:41 2015 +0200
----------------------------------------------------------------------
.../component/jetty/JettyResponseBodyWhenErrorTest.java | 2 +-
.../jettyproducer/JettyHttpProducerRedirectTest.java | 2 +-
.../jetty/jettyproducer/JettyHttpProducerTimeoutTest.java | 2 +-
.../JettyHttpProducerTransferExceptionTest.java | 2 +-
.../java/org/apache/camel/test/junit4/TestSupport.java | 10 +---------
5 files changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2b9ccadf/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java
index 80de7d6..1fec3a6 100644
--- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java
@@ -34,7 +34,7 @@ public class JettyResponseBodyWhenErrorTest extends BaseJettyTest {
template.requestBody("http://localhost:{{port}}/myapp/myservice", "bookid=123");
fail("Should have thrown an exception");
} catch (RuntimeCamelException e) {
- HttpOperationFailedException cause = assertThrowable(HttpOperationFailedException.class, e.getCause());
+ HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
assertEquals(500, cause.getStatusCode());
String body = context.getTypeConverter().convertTo(String.class, cause.getResponseBody());
assertTrue(body.indexOf("Damm") > -1);
http://git-wip-us.apache.org/repos/asf/camel/blob/2b9ccadf/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java
index 74c4159..0c8379b 100644
--- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerRedirectTest.java
@@ -35,7 +35,7 @@ public class JettyHttpProducerRedirectTest extends BaseJettyTest {
template.requestBody("jetty:http://localhost:{{port}}/test", "Hello World", String.class);
fail("Should have thrown an exception");
} catch (RuntimeCamelException e) {
- HttpOperationFailedException cause = assertThrowable(HttpOperationFailedException.class, e.getCause());
+ HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
assertEquals(301, cause.getStatusCode());
assertEquals(true, cause.isRedirectError());
assertEquals(true, cause.hasRedirectLocation());
http://git-wip-us.apache.org/repos/asf/camel/blob/2b9ccadf/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java
index 0192953..b316c96 100644
--- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java
@@ -49,7 +49,7 @@ public class JettyHttpProducerTimeoutTest extends BaseJettyTest {
});
Exception e = reply.getException();
assertNotNull("Should have thrown an exception", e);
- ExchangeTimedOutException cause = assertThrowable(ExchangeTimedOutException.class, e);
+ ExchangeTimedOutException cause = assertIsInstanceOf(ExchangeTimedOutException.class, e);
assertEquals(2000, cause.getTimeout());
assertTrue("The input stream should be closed", is.isClosed());
}
http://git-wip-us.apache.org/repos/asf/camel/blob/2b9ccadf/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTransferExceptionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTransferExceptionTest.java b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTransferExceptionTest.java
index 1c59c4f..29f8a1e 100644
--- a/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTransferExceptionTest.java
+++ b/components/camel-jetty9/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTransferExceptionTest.java
@@ -32,7 +32,7 @@ public class JettyHttpProducerTransferExceptionTest extends BaseJettyTest {
template.requestBody("jetty:http://localhost:{{port}}/myapp/myservice?transferException=true", "");
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
- IllegalArgumentException cause = assertThrowable(IllegalArgumentException.class, e.getCause());
+ IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
assertEquals("Damn", cause.getMessage());
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/2b9ccadf/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
index 8a4c39a..7c8d2b5 100644
--- a/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
+++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
@@ -140,18 +140,10 @@ public abstract class TestSupport extends Assert {
public static <T> T assertIsInstanceOf(Class<T> expectedType, Object value) {
assertNotNull("Expected an instance of type: " + expectedType.getName() + " but was null", value);
- assertTrue("object should be a " + expectedType.getName() + " but was: " + value + " with type: "
+ assertTrue("Object should be of type " + expectedType.getName() + " but was: " + value + " with the type: "
+ value.getClass().getName(), expectedType.isInstance(value));
return expectedType.cast(value);
}
-
- public static <T extends Throwable> T assertThrowable(Class<T> expectedType, Throwable t) {
- assertNotNull("Expected an exinstance of type: " + expectedType.getName() + " but was null", t);
- if (!expectedType.isInstance(t)) {
- throw new AssertionError("Unexpected throwable", t);
- }
- return expectedType.cast(t);
- }
public static void assertEndpointUri(Endpoint endpoint, String uri) {
assertNotNull("Endpoint is null when expecting endpoint for: " + uri, endpoint);