### Question:
ServiceInstanceRestHandler extends AbstractRestHandler { public Recipe findServiceRecipe(String modelUUID, String action) throws NoRecipeException { ServiceRecipe recipe = catalogDbClient.findServiceRecipeByActionAndServiceModelUUID(action, modelUUID); if (recipe == null) { recipe = catalogDbClient.findServiceRecipeByActionAndServiceModelUUID(action, DEFAULT_VF_MODULE_UUID); } if (recipe == null) { throw new NoRecipeException(String.format( "Unable to locate custom or default recipe for, Action: %s, Model UUID: %s", action, modelUUID)); } return recipe; }  InfraActiveRequests mapInfraActiveRequestForDelete(String requestId, String serviceInstanceId,
            String requestorId, String source, String requestURL); InfraActiveRequests createInfraActiveRequestForDelete(String requestId, String serviceInstanceId,
            String requestorId, String source, String requestURL); RequestClientParameter buildRequestParams(ServiceInstancesRequest request, String requestURI,
            String requestId, String serviceInstanceId); void saveInstanceName(ServiceInstancesRequest request, InfraActiveRequests currentRequest); void checkDuplicateRequest(String serviceInstanceId, String instanceName, String requestId); Recipe findServiceRecipe(String modelUUID, String action);  }### Answer:
@Test public void test_find_service_recipe() throws MalformedURLException, NoRecipeException { ServiceRecipe expected = new ServiceRecipe(); expected.setAction("createInstance"); doReturn(expected).when(catalogDbClient) .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId"); Recipe actual = restHandler.findServiceRecipe("testModelId", Action.createInstance.toString()); assertThat(actual, sameBeanAs(expected)); Mockito.verify(catalogDbClient, Mockito.times(1)) .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId"); }
@Test public void test_find_service_recipe_default_recipe() throws MalformedURLException, NoRecipeException { ServiceRecipe expected = new ServiceRecipe(); expected.setAction("createInstance"); doReturn(null).when(catalogDbClient) .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId"); doReturn(expected).when(catalogDbClient).findServiceRecipeByActionAndServiceModelUUID( Action.createInstance.toString(), "d88da85c-d9e8-4f73-b837-3a72a431622b"); Recipe actual = restHandler.findServiceRecipe("testModelId", Action.createInstance.toString()); assertThat(actual, sameBeanAs(expected)); Mockito.verify(catalogDbClient, Mockito.times(1)) .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId"); Mockito.verify(catalogDbClient, Mockito.times(1)).findServiceRecipeByActionAndServiceModelUUID( Action.createInstance.toString(), "d88da85c-d9e8-4f73-b837-3a72a431622b"); }
@Test public void test_find_service_recipe_not_found() throws MalformedURLException, NoRecipeException { ServiceRecipe expected = new ServiceRecipe(); expected.setAction("createInstance"); doReturn(null).when(catalogDbClient) .findServiceRecipeByActionAndServiceModelUUID(Action.createInstance.toString(), "testModelId"); doReturn(null).when(catalogDbClient).findServiceRecipeByActionAndServiceModelUUID( Action.createInstance.toString(), "d88da85c-d9e8-4f73-b837-3a72a431622b"); exceptionRule.expect(NoRecipeException.class); exceptionRule.expectMessage( "Unable to locate custom or default recipe for, Action: createInstance, Model UUID: testModelId"); restHandler.findServiceRecipe("testModelId", Action.createInstance.toString()); }