DisableStreamingTaskParameters { public static DisableStreamingTaskParameters deserialize(String taskParameters) { JaxbJsonSerializer<DisableStreamingTaskParameters> serializer = new JaxbJsonSerializer<>(DisableStreamingTaskParameters.class); try { DisableStreamingTaskParameters params = serializer.deserialize(taskParameters); if (null == params.getSpaceId() || params.getSpaceId().isEmpty()) { throw new TaskDataException( "Task parameter values may not be empty"); } return params; } catch (IOException e) { throw new TaskDataException( "Unable to parse task parameters due to: " + e.getMessage()); } } DisableStreamingTaskParameters(); String getSpaceId(); void setSpaceId(String spaceId); String serialize(); static DisableStreamingTaskParameters deserialize(String taskParameters);  }
@Test public void testDeserialize() { String taskParamsSerialized = "{\"spaceId\" : \"" + spaceId + "\"}"; DisableStreamingTaskParameters taskParams = DisableStreamingTaskParameters.deserialize(taskParamsSerialized); assertEquals(spaceId, taskParams.getSpaceId()); taskParamsSerialized = "{\"spaceId\" : \"\"}"; try { DisableStreamingTaskParameters.deserialize(taskParamsSerialized); fail("Exception expected: Invalid params"); } catch (TaskDataException e) { } try { DisableStreamingTaskParameters.deserialize(""); fail("Exception expected: Invalid params"); } catch (TaskDataException e) { } }