You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@johnzon.apache.org by st...@apache.org on 2016/12/12 12:05:51 UTC
johnzon git commit: add test for binary download (should not trigger
Json)
Repository: johnzon
Updated Branches:
refs/heads/master ed2a42ef1 -> e158d3085
add test for binary download (should not trigger Json)
Project: http://git-wip-us.apache.org/repos/asf/johnzon/repo
Commit: http://git-wip-us.apache.org/repos/asf/johnzon/commit/e158d308
Tree: http://git-wip-us.apache.org/repos/asf/johnzon/tree/e158d308
Diff: http://git-wip-us.apache.org/repos/asf/johnzon/diff/e158d308
Branch: refs/heads/master
Commit: e158d3085cf193bd345e88ce6db09167f5cfa86f
Parents: ed2a42e
Author: Mark Struberg <st...@apache.org>
Authored: Mon Dec 12 13:05:23 2016 +0100
Committer: Mark Struberg <st...@apache.org>
Committed: Mon Dec 12 13:05:23 2016 +0100
----------------------------------------------------------------------
.../johnzon/jsonb/jaxrs/JsonbJaxRsTest.java | 25 ++++++++++++++++++++
1 file changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/johnzon/blob/e158d308/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/jaxrs/JsonbJaxRsTest.java
----------------------------------------------------------------------
diff --git a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/jaxrs/JsonbJaxRsTest.java b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/jaxrs/JsonbJaxRsTest.java
index 4627ca8..d733447 100644
--- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/jaxrs/JsonbJaxRsTest.java
+++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/jaxrs/JsonbJaxRsTest.java
@@ -25,6 +25,7 @@ import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.apache.cxf.transport.local.LocalConduit;
import org.apache.johnzon.jaxrs.jsonb.jaxrs.JsonbJaxrsProvider;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -105,6 +106,18 @@ public class JsonbJaxRsTest {
}
@Test
+ public void testBinaryDownload() {
+ byte[] content = client(MediaType.TEXT_PLAIN_TYPE)
+ .path("johnzon/mybinary")
+ .get(byte[].class);
+
+ Assert.assertEquals(100, content.length);
+ for (int i=0; i < 100; i++) {
+ Assert.assertEquals((byte) i, content[i]);
+ }
+ }
+
+ @Test
public void list() {
final ParameterizedType list = new ParameterizedType() {
@Override
@@ -202,5 +215,17 @@ public class JsonbJaxRsTest {
public Integer primitive() {
return 1986;
}
+
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ @Path("mybinary")
+ public byte[] binary() {
+ byte[] content = new byte[100];
+ for (int i=0; i < 100; i++) {
+ content[i] = (byte) i;
+ }
+
+ return content;
+ }
}
}