@Test public void testAppendElement() { Map<String, String> result = listAppender.appendElement(LIST, "Deadpool", ","); assertEquals(APPENDED_LIST, result.get(RETURN_RESULT)); assertEquals(RETURN_CODE_SUCCESS, result.get(RETURN_CODE)); }
@Action(name = "List Appender", outputs = { @Output(RESPONSE), @Output(RETURN_RESULT), @Output(RETURN_CODE) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL), @Response(text = FAILURE, field = RETURN_CODE, value = RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, isOnFail = true, isDefault = true) }) public Map<String, String> appendElement(@Param(value = LIST, required = true) String list, @Param(value = ELEMENT, required = true) String element, @Param(value = DELIMITER) String delimiter) { Map<String, String> result = new HashMap<>(); try { StringBuilder sb = new StringBuilder(); sb = StringUtils.isEmpty(list) ? sb.append(element) : sb.append(list).append(delimiter).append(element); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sb.toString()); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; }
ListAppenderAction { @Action(name = "List Appender", outputs = { @Output(RESPONSE), @Output(RETURN_RESULT), @Output(RETURN_CODE) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL), @Response(text = FAILURE, field = RETURN_CODE, value = RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, isOnFail = true, isDefault = true) }) public Map<String, String> appendElement(@Param(value = LIST, required = true) String list, @Param(value = ELEMENT, required = true) String element, @Param(value = DELIMITER) String delimiter) { Map<String, String> result = new HashMap<>(); try { StringBuilder sb = new StringBuilder(); sb = StringUtils.isEmpty(list) ? sb.append(element) : sb.append(list).append(delimiter).append(element); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sb.toString()); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; } }
ListAppenderAction { @Action(name = "List Appender", outputs = { @Output(RESPONSE), @Output(RETURN_RESULT), @Output(RETURN_CODE) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL), @Response(text = FAILURE, field = RETURN_CODE, value = RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, isOnFail = true, isDefault = true) }) public Map<String, String> appendElement(@Param(value = LIST, required = true) String list, @Param(value = ELEMENT, required = true) String element, @Param(value = DELIMITER) String delimiter) { Map<String, String> result = new HashMap<>(); try { StringBuilder sb = new StringBuilder(); sb = StringUtils.isEmpty(list) ? sb.append(element) : sb.append(list).append(delimiter).append(element); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sb.toString()); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; }  }
ListAppenderAction { @Action(name = "List Appender", outputs = { @Output(RESPONSE), @Output(RETURN_RESULT), @Output(RETURN_CODE) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL), @Response(text = FAILURE, field = RETURN_CODE, value = RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, isOnFail = true, isDefault = true) }) public Map<String, String> appendElement(@Param(value = LIST, required = true) String list, @Param(value = ELEMENT, required = true) String element, @Param(value = DELIMITER) String delimiter) { Map<String, String> result = new HashMap<>(); try { StringBuilder sb = new StringBuilder(); sb = StringUtils.isEmpty(list) ? sb.append(element) : sb.append(list).append(delimiter).append(element); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sb.toString()); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; }  @Action(name = "List Appender", outputs = { @Output(RESPONSE), @Output(RETURN_RESULT), @Output(RETURN_CODE) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL), @Response(text = FAILURE, field = RETURN_CODE, value = RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, isOnFail = true, isDefault = true) }) Map<String, String> appendElement(@Param(value = LIST, required = true) String list,
                                             @Param(value = ELEMENT, required = true) String element,
                                             @Param(value = DELIMITER) String delimiter); }
ListAppenderAction { @Action(name = "List Appender", outputs = { @Output(RESPONSE), @Output(RETURN_RESULT), @Output(RETURN_CODE) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL), @Response(text = FAILURE, field = RETURN_CODE, value = RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, isOnFail = true, isDefault = true) }) public Map<String, String> appendElement(@Param(value = LIST, required = true) String list, @Param(value = ELEMENT, required = true) String element, @Param(value = DELIMITER) String delimiter) { Map<String, String> result = new HashMap<>(); try { StringBuilder sb = new StringBuilder(); sb = StringUtils.isEmpty(list) ? sb.append(element) : sb.append(list).append(delimiter).append(element); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sb.toString()); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; }  @Action(name = "List Appender", outputs = { @Output(RESPONSE), @Output(RETURN_RESULT), @Output(RETURN_CODE) }, responses = { @Response(text = SUCCESS, field = RETURN_CODE, value = RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL), @Response(text = FAILURE, field = RETURN_CODE, value = RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, isOnFail = true, isDefault = true) }) Map<String, String> appendElement(@Param(value = LIST, required = true) String list,
                                             @Param(value = ELEMENT, required = true) String element,
                                             @Param(value = DELIMITER) String delimiter);  }