/** * Construct an exception with an error code and the expected and provided versions. * * @param errorCode a single word in camel case that uniquely identifies the error condition * @param expectedVersion the version expected by the service broker * @param providedVersion the version provided by the platform */ public ServiceBrokerApiVersionException(String errorCode, String expectedVersion, String providedVersion) { super(errorCode, ServiceBrokerApiVersionErrorMessage.from(expectedVersion, providedVersion).toString()); } }
/** * Construct an exception with the expected and provided versions. * * @param expectedVersion the version expected by the service broker * @param providedVersion the version provided by the platform */ public ServiceBrokerApiVersionException(String expectedVersion, String providedVersion) { super(ServiceBrokerApiVersionErrorMessage.from(expectedVersion, providedVersion).toString()); }
/** * Construct an exception with an error code and the expected and provided versions. * * @param errorCode a single word in camel case that uniquely identifies the error condition * @param expectedVersion the version expected by the service broker * @param providedVersion the version provided by the platform */ public ServiceBrokerApiVersionException(String errorCode, String expectedVersion, String providedVersion) { super(errorCode, ServiceBrokerApiVersionErrorMessage.from(expectedVersion, providedVersion).toString()); } }
/** * Construct an exception with the expected and provided versions. * * @param expectedVersion the version expected by the service broker * @param providedVersion the version provided by the platform */ public ServiceBrokerApiVersionException(String expectedVersion, String providedVersion) { super(ServiceBrokerApiVersionErrorMessage.from(expectedVersion, providedVersion).toString()); }
@Test public void nulls() { ServiceBrokerApiVersionErrorMessage message = ServiceBrokerApiVersionErrorMessage.from(null, null); assertThat(message.toString()).isEqualTo("The provided service broker API version is not supported: expected version=null, provided version=null"); }
@Test public void from() { ServiceBrokerApiVersionErrorMessage message = ServiceBrokerApiVersionErrorMessage.from("expected-version2", "actual-version2"); assertThat(message.toString()).isEqualTo("The provided service broker API version is not supported: expected version=expected-version2, provided version=actual-version2"); } }
@Test public void message() { ServiceBrokerApiVersionErrorMessage message = ServiceBrokerApiVersionErrorMessage.from("expected-version", "actual-version"); assertThat(message.toString()).isEqualTo("The provided service broker API version is not supported: expected version=expected-version, provided version=actual-version"); }
String apiVersion = exchange.getRequest().getHeaders().getFirst(version.getBrokerApiVersionHeader()); if (!version.getApiVersion().equals(apiVersion)) { String message = ServiceBrokerApiVersionErrorMessage.from(version.getApiVersion(), apiVersion).toString(); ServerHttpResponse response = exchange.getResponse(); String json;