Ejemplo n.º 1
0
 @Test
 public void read_document_as_stream() throws Exception {
   // content type is really json but it doesn't matter here.
   ResponseOnFileStub rsp = ResponseOnFileStub.newInstance(200, "attachment.txt");
   when(httpClient.get("/test_db/some_doc_id")).thenReturn(rsp);
   InputStream data = dbCon.getAsStream("some_doc_id");
   assertNotNull(data);
   assertFalse(rsp.isConnectionReleased());
   assertEquals("detta är ett påhäng med ett ö i", IOUtils.toString(data, "UTF-8"));
 }