use of com.linkedin.multipart.exceptions.SinglePartNotInitializedException in project rest.li by linkedin.
the class TestMIMEReaderStateTransitions method testSinglePartMIMEReaderRequestData.
@Test
public void testSinglePartMIMEReaderRequestData() {
final EntityStream entityStream = mock(EntityStream.class);
final StreamRequest streamRequest = mock(StreamRequest.class);
when(streamRequest.getEntityStream()).thenReturn(entityStream);
when(streamRequest.getHeader(MultiPartMIMEUtils.CONTENT_TYPE_HEADER)).thenReturn("multipart/mixed; boundary=\"--123\"");
MultiPartMIMEReader reader = MultiPartMIMEReader.createAndAcquireStream(streamRequest);
final MultiPartMIMEReader.SinglePartMIMEReader singlePartMIMEReader = reader.new SinglePartMIMEReader(Collections.<String, String>emptyMap());
singlePartMIMEReader.setState(MultiPartMIMEReader.SingleReaderState.CREATED);
try {
singlePartMIMEReader.requestPartData();
Assert.fail();
} catch (SinglePartNotInitializedException singlePartNotInitializedException) {
}
}
Aggregations