use of com.linkedin.restli.server.annotations.UnstructuredDataWriterParam in project rest.li by linkedin.
the class TestArgumentBuilder method testUnstructuredDataWriterParam.
@Test
public void testUnstructuredDataWriterParam() {
ServerResourceContext mockResourceContext = EasyMock.createMock(ServerResourceContext.class);
mockResourceContext.setResponseEntityStream(EasyMock.anyObject());
EasyMock.expectLastCall().once();
EasyMock.expect(mockResourceContext.getRequestAttachmentReader()).andReturn(null);
EasyMock.replay(mockResourceContext);
@SuppressWarnings({ "unchecked", "rawtypes" }) final Parameter<UnstructuredDataWriterParam> param = new Parameter("RestLi Unstructured Data Writer", UnstructuredDataWriter.class, null, false, null, Parameter.ParamType.UNSTRUCTURED_DATA_WRITER_PARAM, false, AnnotationSet.EMPTY);
List<Parameter<?>> parameters = Collections.singletonList(param);
Object[] results = ArgumentBuilder.buildArgs(new Object[0], getMockResourceMethod(parameters), mockResourceContext, null, getMockResourceMethodConfig(false));
UnstructuredDataWriter result = (UnstructuredDataWriter) results[0];
Assert.assertNotNull(result);
Assert.assertTrue(result.getOutputStream() instanceof ByteArrayOutputStream);
EasyMock.verify(mockResourceContext);
}
Aggregations