@SuppressWarnings("unchecked")
@Test
public void getsBodyAsCustomType() throws Exception {

    Class<List> type = List.class;
    ParameterizedType genericType = newParameterizedType(List.class, String.class);
    Annotation[] annotations = new Annotation[0];
    InputStream in = mock(InputStream.class);
    when(fileItem.getInputStream()).thenReturn(in);
    when(fileItem.getContentType()).thenReturn(TEXT_PLAIN_TYPE.toString());
    MessageBodyReader reader = mock(MessageBodyReader.class);
    ArrayList<String> bodyAsList = newArrayList("to", "be", "or", "not", "to", "be");
    when(reader.readFrom(eq(type), eq(genericType), aryEq(annotations), eq(TEXT_PLAIN_TYPE), any(), eq(in))).thenReturn(bodyAsList);
    when(providers.getMessageBodyReader(eq(type), eq(genericType), aryEq(annotations), eq(TEXT_PLAIN_TYPE))).thenReturn(reader);
    assertEquals(bodyAsList, inputItem.getBody(type, genericType));
}