You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2017/06/22 11:09:50 UTC
[2/2] cxf git commit: [CXF-7424] Adding a test
[CXF-7424] Adding a test
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ac84efb2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ac84efb2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ac84efb2
Branch: refs/heads/3.0.x-fixes
Commit: ac84efb25a3a97c55b428f26f0a08777f726c70d
Parents: 7d33e71
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Thu Jun 22 11:10:02 2017 +0100
Committer: Sergey Beryozkin <sb...@gmail.com>
Committed: Thu Jun 22 12:09:34 2017 +0100
----------------------------------------------------------------------
.../jaxrs/provider/BinaryDataProviderTest.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/ac84efb2/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/BinaryDataProviderTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/BinaryDataProviderTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/BinaryDataProviderTest.java
index 0a9ff02..87aca72 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/BinaryDataProviderTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/BinaryDataProviderTest.java
@@ -98,6 +98,24 @@ public class BinaryDataProviderTest extends Assert {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
+ public void testReadBytesFromUtf8() throws Exception {
+ MessageBodyReader p = new BinaryDataProvider();
+ byte[] utf8Bytes = "世界ーファイル".getBytes("UTF-8");
+ byte[] readBytes = (byte[])p.readFrom(byte[].class, byte[].class, new Annotation[]{},
+ MediaType.APPLICATION_OCTET_STREAM_TYPE,
+ new MetadataMap<String, Object>(),
+ new ByteArrayInputStream(utf8Bytes));
+ assertTrue(Arrays.equals(utf8Bytes, readBytes));
+
+ readBytes = (byte[])p.readFrom(byte[].class, byte[].class, new Annotation[]{},
+ MediaType.valueOf("application/octet-stream;charset=UTF-8"),
+ new MetadataMap<String, Object>(),
+ new ByteArrayInputStream(utf8Bytes));
+ assertTrue(Arrays.equals(utf8Bytes, readBytes));
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Test
public void testWriteTo() throws Exception {
MessageBodyWriter p = new BinaryDataProvider();
ByteArrayOutputStream os = new ByteArrayOutputStream();