Multipart with DataSource throwing "No Serializer Found" Exception

4,074 views
Skip to first unread message

Reza

unread,
Feb 4, 2017, 6:41:57 AM2/4/17
to REST assured
Hey guys, 

I am trying to test a PUT request with test assured. The request takes a multipart param with DataSource (javax.activation) as value. 
@Multipart("image") DataSource image



I keep receiving the serializable exception: 

No serializer found for class java.io.BufferedInputStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )

 Here is my rest assured test:

InputStream is = myClass.class.getClassLoader().getResourceAsStream("somePic.png");
DataSource ds = new InputStreamDataSource(imageStream, MediaType.IMAGE_PNG_VALUE);

given
(getDocumentationSpec())
     
.sessionId(user)
     
.multiPart("image", ds)
     
.contentType("multipart/form-data")
     
.when()
     
.put("path", userId)
     
.then()
     
.statusCode(Status.OK.getStatusCode());

Any idea? 

Johan Haleby

unread,
Feb 5, 2017, 1:47:09 AM2/5/17
to rest-a...@googlegroups.com
Could you try passing it as an inputstream instead?

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reza

unread,
Feb 8, 2017, 10:43:21 AM2/8/17
to REST assured
I cannot because the API takes only DataSource
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.

Johan Haleby

unread,
Feb 9, 2017, 1:37:13 AM2/9/17
to rest-a...@googlegroups.com
What about something like this? http://stackoverflow.com/a/35345564/398441. Use it to convert it to an input stream that you pass to RA.

To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured+unsubscribe@googlegroups.com.

Reza

unread,
Feb 9, 2017, 2:50:04 PM2/9/17
to REST assured
Tried it .. did not work... The same serialization issue!
Reply all
Reply to author
Forward
0 new messages