### Question:
EnvironmentServicesFinder { public CfJdbcService findJdbcService(String name) { if (StringUtils.isEmpty(name)) { return null; } try { return env.findJdbcServiceByName(name); } catch (IllegalArgumentException e) { return null; } } EnvironmentServicesFinder();  EnvironmentServicesFinder(CfJdbcEnv env); CfJdbcService findJdbcService(String name); CfService findService(String name);  }### Answer:
@Test void testFindJdbcService() { CfJdbcService expectedService = Mockito.mock(CfJdbcService.class); Mockito.when(env.findJdbcServiceByName(SERVICE_NAME)) .thenReturn(expectedService); CfJdbcService service = environmentServicesFinder.findJdbcService(SERVICE_NAME); Assertions.assertEquals(expectedService, service); }
@Test void testFindJdbcServiceWithZeroOrMultipleMatches() { Mockito.when(env.findJdbcServiceByName(SERVICE_NAME)) .thenThrow(IllegalArgumentException.class); CfJdbcService service = environmentServicesFinder.findJdbcService(SERVICE_NAME); Assertions.assertNull(service); }
@Test void testFindJdbcServiceWithNullOrEmptyServiceName() { Assertions.assertNull(environmentServicesFinder.findJdbcService(null)); Assertions.assertNull(environmentServicesFinder.findJdbcService("")); }