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:05:59 UTC
cxf git commit: [CXF-7424] Adding a test
Repository: cxf
Updated Branches:
refs/heads/3.1.x-fixes 835d0eec8 -> 776264dde
[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/776264dd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/776264dd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/776264dd
Branch: refs/heads/3.1.x-fixes
Commit: 776264dde98070d302bd4c8dc71848de6834b3d8
Parents: 835d0ee
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:05:37 2017 +0100
----------------------------------------------------------------------
.../jaxrs/provider/BinaryDataProviderTest.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/776264dd/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();