@Test public void testSortLetters() { Map<String, String> result1 = new ListSortAction().sortList(LIST_STRING, ",", "false"); assertEquals("success", result1.get("response")); assertEquals("a,b,g,s,z", result1.get("result")); }
@Action(name = "List Sort", outputs = { @Output(RESULT_TEXT), @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> sortList(@Param(value = LIST, required = true) String list, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = REVERSE) String reverse) { Map<String, String> result = new HashMap<>(); try { String sortedList = sort(list, Boolean.parseBoolean(reverse), delimiter); result.put(RESULT_TEXT, sortedList); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sortedList); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESULT_TEXT, e.getMessage()); result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; }
ListSortAction { @Action(name = "List Sort", outputs = { @Output(RESULT_TEXT), @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> sortList(@Param(value = LIST, required = true) String list, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = REVERSE) String reverse) { Map<String, String> result = new HashMap<>(); try { String sortedList = sort(list, Boolean.parseBoolean(reverse), delimiter); result.put(RESULT_TEXT, sortedList); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sortedList); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESULT_TEXT, e.getMessage()); result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; } }
ListSortAction { @Action(name = "List Sort", outputs = { @Output(RESULT_TEXT), @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> sortList(@Param(value = LIST, required = true) String list, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = REVERSE) String reverse) { Map<String, String> result = new HashMap<>(); try { String sortedList = sort(list, Boolean.parseBoolean(reverse), delimiter); result.put(RESULT_TEXT, sortedList); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sortedList); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESULT_TEXT, e.getMessage()); result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; }  }
ListSortAction { @Action(name = "List Sort", outputs = { @Output(RESULT_TEXT), @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> sortList(@Param(value = LIST, required = true) String list, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = REVERSE) String reverse) { Map<String, String> result = new HashMap<>(); try { String sortedList = sort(list, Boolean.parseBoolean(reverse), delimiter); result.put(RESULT_TEXT, sortedList); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sortedList); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESULT_TEXT, e.getMessage()); result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; }  @Action(name = "List Sort", outputs = { @Output(RESULT_TEXT), @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> sortList(@Param(value = LIST, required = true) String list,
                                        @Param(value = DELIMITER, required = true) String delimiter,
                                        @Param(value = REVERSE) String reverse); }
ListSortAction { @Action(name = "List Sort", outputs = { @Output(RESULT_TEXT), @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> sortList(@Param(value = LIST, required = true) String list, @Param(value = DELIMITER, required = true) String delimiter, @Param(value = REVERSE) String reverse) { Map<String, String> result = new HashMap<>(); try { String sortedList = sort(list, Boolean.parseBoolean(reverse), delimiter); result.put(RESULT_TEXT, sortedList); result.put(RESPONSE, SUCCESS); result.put(RETURN_RESULT, sortedList); result.put(RETURN_CODE, RETURN_CODE_SUCCESS); } catch (Exception e) { result.put(RESULT_TEXT, e.getMessage()); result.put(RESPONSE, FAILURE); result.put(RETURN_RESULT, e.getMessage()); result.put(RETURN_CODE, RETURN_CODE_FAILURE); } return result; }  @Action(name = "List Sort", outputs = { @Output(RESULT_TEXT), @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> sortList(@Param(value = LIST, required = true) String list,
                                        @Param(value = DELIMITER, required = true) String delimiter,
                                        @Param(value = REVERSE) String reverse);  }