InputStream entityStream = new ByteArrayInputStream(message);
MultiPartFormMessageBodyReader multiPartFormMBR = new MultiPartFormMessageBodyReader();
MediaType mediaType = MediaType.valueOf("multipart/form-data; boundary=AaB03x");
MultiPartBody multiPartBody = multiPartFormMBR.readFrom(null, null, null, mediaType, null, entityStream);
String[] paramNames = multiPartBody.getParameterNames();
String[] expectedParamNames = {paramName1, paramName2, paramName3};
System.out.println(Arrays.toString(paramNames));
Assert.assertArrayEquals(expectedParamNames, paramNames);
Assert.assertEquals(field1Value, multiPartBody.getParameteValues(paramName1)[0].toString());
Assert.assertEquals(field2Value, multiPartBody.getParameteValues(paramName2)[0].toString());
String[] fileParamNames = multiPartBody.getFileParameterNames();
String[] expectedFileParamNames = {paramName3};
Assert.assertArrayEquals(expectedFileParamNames, fileParamNames);
FormFile[] formFiles = multiPartBody.getFormFileParameterValues(paramName3);
Assert.assertArrayEquals(binaryData.getBytes(), formFiles[0].getContent());
Assert.assertEquals(MediaType.valueOf(binaryMimeType), formFiles[0].getMediaType());
Assert.assertEquals(binaryFilename, formFiles[0].getFileName());
}