+
+ @Test
+ public void validateSolution_success() throws Exception {
+ String json = "{\"value\" : \"test1\"}";
+ new OofValidator().validateSolution(json);
+ }
+
+ @Test
+ public void validateSolution_EmptyResponse() {
+ try {
+ new OofValidator().validateSolution("");
+ } catch (BadResponseException e) {
+ assertThat(e.getMessage()).contains("oofs asynchronous response is empty");
+ }
+ }
+
+ @Test
+ public void validateSolution_serviceExceptionWithMessage() {
+ String json = "{\"serviceException\" : {\"text\" : \"serviceExceptionOccurred\"}}";
+ try {
+ new OofValidator().validateSolution(json);
+ fail("Exception should be thrown");
+ } catch (BadResponseException e) {
+ assertThat(e.getMessage()).contains("serviceExceptionOccurred");
+ }
+ }
+
+ @Test
+ public void validateSolution_serviceExceptionWithEmptyMessage() {
+ String json = "{\"serviceException\" : {\"text\" : \"\"}}";
+ try {
+ new OofValidator().validateSolution(json);
+ fail("Exception should be thrown");
+ } catch (BadResponseException e) {
+ assertThat(e.getMessage()).contains("error message not provided");
+ }
+ }