use of org.wso2.carbon.apimgt.core.models.DocumentContent in project carbon-apimgt by wso2.
the class ApisApiServiceImplTestCase method testApisApiIdDocumentsDocumentIdContentGetInline.
@Test
public void testApisApiIdDocumentsDocumentIdContentGetInline() throws Exception {
String inlineContent = "INLINE CONTENT";
printTestMethodName();
ApisApiServiceImpl apisApiService = new ApisApiServiceImpl();
APIPublisher apiPublisher = Mockito.mock(APIPublisherImpl.class);
PowerMockito.mockStatic(RestAPIPublisherUtil.class);
PowerMockito.when(RestAPIPublisherUtil.getApiPublisher(USER)).thenReturn(apiPublisher);
String api1Id = UUID.randomUUID().toString();
String documentId = UUID.randomUUID().toString();
DocumentInfo documentInfo = SampleTestObjectCreator.createDefaultDocumentationInfo().build();
DocumentContent documentContent = DocumentContent.newDocumentContent().inlineContent(inlineContent).documentInfo(documentInfo).build();
Mockito.doReturn(documentContent).doThrow(new IllegalArgumentException()).when(apiPublisher).getDocumentationContent(documentId);
Response response = apisApiService.apisApiIdDocumentsDocumentIdContentGet(api1Id, documentId, null, null, getRequest());
assertEquals(response.getStatus(), 200);
assertEquals(inlineContent, response.getEntity().toString());
}
Aggregations