SnapshotErrorBridgeParameters { public String serialize() { JaxbJsonSerializer<SnapshotErrorBridgeParameters> serializer = new JaxbJsonSerializer<>(SnapshotErrorBridgeParameters.class); try { return serializer.serialize(this); } catch (IOException e) { throw new SnapshotDataException( "Unable to create task result due to: " + e.getMessage()); } } SnapshotErrorBridgeParameters();  SnapshotErrorBridgeParameters(String error); String getError(); void setError(String error); String serialize();  }
@Test public void testSerialize() { String error = "an-error-description"; SnapshotErrorBridgeParameters params = new SnapshotErrorBridgeParameters(error); String result = params.serialize(); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"error\":\"" + error + "\"")); }