### Question:
TransformApiDocService { public String transformApiDoc(String serviceId, ApiDocInfo apiDocInfo) { AbstractApiDocService abstractApiDocService = beanApiDocFactory.apply(apiDocInfo.getApiDocContent()); if (abstractApiDocService == null) { throw new UnexpectedTypeException("Response is not a Swagger or OpenAPI type object."); } return abstractApiDocService.transformApiDoc(serviceId, apiDocInfo); }  String transformApiDoc(String serviceId, ApiDocInfo apiDocInfo);  }### Answer:
@Test public void testTransformApiDoc_whenSwaggerDocIsPresent() { ApiDocInfo apiDocInfo = new ApiDocInfo(null, "DOC2", null); transformApiDocService.transformApiDoc(SERVICE_ID, apiDocInfo); verify( beanApiDocFactory.apply("DOC2") ).transformApiDoc(SERVICE_ID, apiDocInfo); verify( beanApiDocFactory.apply("DOC3"), never() ).transformApiDoc(SERVICE_ID, apiDocInfo); }
@Test public void testTransformApiDoc_whenOpenDocIsPresent() { ApiDocInfo apiDocInfo = new ApiDocInfo(null, "DOC3", null); transformApiDocService.transformApiDoc(SERVICE_ID, apiDocInfo); verify( beanApiDocFactory.apply("DOC3") ).transformApiDoc(SERVICE_ID, apiDocInfo); verify( beanApiDocFactory.apply("DOC2"), never() ).transformApiDoc(SERVICE_ID, apiDocInfo); }
@Test public void testTransformApiDoc_whenThereIsNotApiDocMatch() { exceptionRule.expect(UnexpectedTypeException.class); exceptionRule.expectMessage("Response is not a Swagger or OpenAPI type object"); ApiDocInfo apiDocInfo = new ApiDocInfo(null, "DOC4", null); transformApiDocService.transformApiDoc(SERVICE_ID, apiDocInfo); }