@Test public void shouldConvertToJson() { TextOutputCallback textOutputCallback = new TextOutputCallback(TextOutputCallback.INFORMATION, "MESSAGE"); JsonValue jsonObject = testOutputRestAuthCallbackHandler.convertToJson(textOutputCallback, 1); assertEquals("TextOutputCallback", jsonObject.get("type").asString()); assertNotNull(jsonObject.get("output")); assertEquals(2, jsonObject.get("output").size()); assertEquals("MESSAGE", jsonObject.get("output").get(0).get("value").asString()); assertEquals(TextOutputCallback.INFORMATION, (int) jsonObject.get("output").get(1).get("value").asInteger()); assertEquals(2, jsonObject.size()); }
public JsonValue convertToJson(TextOutputCallback callback, int index) { String message = callback.getMessage(); int messageType = callback.getMessageType(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("message", message)) .addLast(createOutputField("messageType", messageType)) .build(); return jsonValue; }
RestAuthTextOutputCallbackHandler extends AbstractRestAuthCallbackHandler<TextOutputCallback> { public JsonValue convertToJson(TextOutputCallback callback, int index) { String message = callback.getMessage(); int messageType = callback.getMessageType(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("message", message)) .addLast(createOutputField("messageType", messageType)) .build(); return jsonValue; } }
RestAuthTextOutputCallbackHandler extends AbstractRestAuthCallbackHandler<TextOutputCallback> { public JsonValue convertToJson(TextOutputCallback callback, int index) { String message = callback.getMessage(); int messageType = callback.getMessageType(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("message", message)) .addLast(createOutputField("messageType", messageType)) .build(); return jsonValue; }  }
RestAuthTextOutputCallbackHandler extends AbstractRestAuthCallbackHandler<TextOutputCallback> { public JsonValue convertToJson(TextOutputCallback callback, int index) { String message = callback.getMessage(); int messageType = callback.getMessageType(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("message", message)) .addLast(createOutputField("messageType", messageType)) .build(); return jsonValue; }  TextOutputCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response,
            JsonValue postBody, TextOutputCallback originalCallback); String getCallbackClassName(); JsonValue convertToJson(TextOutputCallback callback, int index); TextOutputCallback convertFromJson(TextOutputCallback callback, JsonValue jsonCallback); }
RestAuthTextOutputCallbackHandler extends AbstractRestAuthCallbackHandler<TextOutputCallback> { public JsonValue convertToJson(TextOutputCallback callback, int index) { String message = callback.getMessage(); int messageType = callback.getMessageType(); JsonValue jsonValue = JsonValueBuilder.jsonValue() .put("type", CALLBACK_NAME) .array("output") .add(createOutputField("message", message)) .addLast(createOutputField("messageType", messageType)) .build(); return jsonValue; }  TextOutputCallback handle(HttpHeaders headers, HttpServletRequest request, HttpServletResponse response,
            JsonValue postBody, TextOutputCallback originalCallback); String getCallbackClassName(); JsonValue convertToJson(TextOutputCallback callback, int index); TextOutputCallback convertFromJson(TextOutputCallback callback, JsonValue jsonCallback);  }