### Question:
XsuaaServicesParser { public Properties parseCredentials() throws IOException { Properties properties = new Properties(); JSONObject credentialsJsonObject = parseCredentials(vcapServices); if (credentialsJsonObject != null) { Set<String> keys = credentialsJsonObject.keySet(); for (String key : keys) { properties.put(key, credentialsJsonObject.get(key).toString()); } } return properties; } XsuaaServicesParser();  XsuaaServicesParser(InputStream inputStream);  XsuaaServicesParser(String vcapServicesJson); @Deprecated Optional<String> getAttribute(String name); Properties parseCredentials();  }### Answer:
@Test public void ignoreApiAccessPlan() throws IOException { String vcapMultipleBindings = IOUtils.resourceToString("/vcap_multipleBindings.json", Charset.forName("UTF-8")); XsuaaServicesParser cut = new XsuaaServicesParser(vcapMultipleBindings); Properties properties = cut.parseCredentials(); assertThat(properties.getProperty("clientid")).isEqualTo("client-id"); }
@Test(expected = IllegalStateException.class) public void doNotAllowBrokerAndApplicationPlan() throws IOException { String vcapMultipleBindings = IOUtils.resourceToString("/vcap_multipleBindings.json", Charset.forName("UTF-8")); vcapMultipleBindings = vcapMultipleBindings.replace("apiaccess", "broker"); XsuaaServicesParser cut = new XsuaaServicesParser(vcapMultipleBindings); cut.parseCredentials(); }
@Test public void acceptVcapServicesWithoutPlan() throws IOException { String vcapMinimalWoPlan = "{\"xsuaa\":[{\"credentials\":{\"clientid\":\"client-id\",\"clientsecret\":\"client-secret\"},\"tags\":[\"xsuaa\"]}]}"; XsuaaServicesParser cut = new XsuaaServicesParser(vcapMinimalWoPlan); Properties properties = cut.parseCredentials(); assertThat(properties.getProperty("clientid")).isEqualTo("client-id"); }