TwilioServiceInfoCreator extends CloudFoundryServiceInfoCreator<TwilioServiceInfo> { @Override public boolean accept(Map<String, Object> serviceData) { Object credObject = serviceData.get("credentials"); if (credObject instanceof Map<?, ?>) { Map<String, Object> credentials = (Map<String, Object>) credObject; Object urlObj = credentials.get("twilio_api_base_url"); if (urlObj instanceof String) { return TWILIO_API_URI.equals((String) urlObj); } } return false; } TwilioServiceInfoCreator(); @Override boolean accept(Map<String, Object> serviceData); @Override TwilioServiceInfo createServiceInfo(Map<String, Object> serviceData);  }
@Test public void testAcceptMapOfStringObject() { Map<String, Object> serviceData = new HashMap<String, Object>(); Map<String, String> credData = new HashMap<String, String>(); credData.put("twilio_api_base_url", "http: serviceData.put("credentials", credData); assertFalse(creator.accept(serviceData)); credData.put("twilio_api_base_url", "https: assertTrue(creator.accept(serviceData)); credData.remove("twilio_api_base_url"); assertFalse(creator.accept(serviceData)); }