@Test public void fromException_exceptionIsNotAbbyySdkException_exceptionIsPresentInOutput() { final String exMsg = "msg"; final Exception ex = new Exception(exMsg); Map<String, String> result = ResultUtils.fromException(ex); assertTrue(result.containsKey(io.cloudslang.content.constants.OutputNames.RETURN_RESULT)); assertTrue(result.containsKey(OutputNames.TXT_RESULT)); assertTrue(result.containsKey(OutputNames.XML_RESULT)); assertTrue(result.containsKey(OutputNames.PDF_URL)); assertTrue(result.containsKey(OutputNames.TASK_ID)); assertTrue(result.containsKey(OutputNames.CREDITS)); assertTrue(result.containsKey(OutputNames.STATUS_CODE)); assertTrue(result.containsKey(io.cloudslang.content.constants.OutputNames.EXCEPTION)); assertTrue(result.containsKey(io.cloudslang.content.constants.OutputNames.RETURN_CODE)); assertTrue(result.containsKey(OutputNames.TIMED_OUT)); assertEquals(exMsg, result.get(io.cloudslang.content.constants.OutputNames.RETURN_RESULT)); assertTrue(result.get(io.cloudslang.content.constants.OutputNames.EXCEPTION).contains(exMsg)); assertEquals(ReturnCodes.FAILURE, result.get(io.cloudslang.content.constants.OutputNames.RETURN_CODE)); }
public static Map<String, String> fromException(@NotNull Exception ex) { Map<String, String> results = createNewEmptyMap(); if (ex instanceof AbbyySdkException && ((AbbyySdkException) ex).getResultsMap() != null) { Map<String, String> map = ((AbbyySdkException) ex).getResultsMap(); for (String outputName : getOutputNames()) { if (map.containsKey(outputName)) { results.put(outputName, map.get(outputName)); } } } results.put(OutputNames.RETURN_RESULT, ex.getMessage()); results.put(OutputNames.EXCEPTION, ExceptionUtils.getStackTrace(ex)); results.put(OutputNames.RETURN_CODE, ReturnCodes.FAILURE); return results; }
ResultUtils { public static Map<String, String> fromException(@NotNull Exception ex) { Map<String, String> results = createNewEmptyMap(); if (ex instanceof AbbyySdkException && ((AbbyySdkException) ex).getResultsMap() != null) { Map<String, String> map = ((AbbyySdkException) ex).getResultsMap(); for (String outputName : getOutputNames()) { if (map.containsKey(outputName)) { results.put(outputName, map.get(outputName)); } } } results.put(OutputNames.RETURN_RESULT, ex.getMessage()); results.put(OutputNames.EXCEPTION, ExceptionUtils.getStackTrace(ex)); results.put(OutputNames.RETURN_CODE, ReturnCodes.FAILURE); return results; } }
ResultUtils { public static Map<String, String> fromException(@NotNull Exception ex) { Map<String, String> results = createNewEmptyMap(); if (ex instanceof AbbyySdkException && ((AbbyySdkException) ex).getResultsMap() != null) { Map<String, String> map = ((AbbyySdkException) ex).getResultsMap(); for (String outputName : getOutputNames()) { if (map.containsKey(outputName)) { results.put(outputName, map.get(outputName)); } } } results.put(OutputNames.RETURN_RESULT, ex.getMessage()); results.put(OutputNames.EXCEPTION, ExceptionUtils.getStackTrace(ex)); results.put(OutputNames.RETURN_CODE, ReturnCodes.FAILURE); return results; }  }
ResultUtils { public static Map<String, String> fromException(@NotNull Exception ex) { Map<String, String> results = createNewEmptyMap(); if (ex instanceof AbbyySdkException && ((AbbyySdkException) ex).getResultsMap() != null) { Map<String, String> map = ((AbbyySdkException) ex).getResultsMap(); for (String outputName : getOutputNames()) { if (map.containsKey(outputName)) { results.put(outputName, map.get(outputName)); } } } results.put(OutputNames.RETURN_RESULT, ex.getMessage()); results.put(OutputNames.EXCEPTION, ExceptionUtils.getStackTrace(ex)); results.put(OutputNames.RETURN_CODE, ReturnCodes.FAILURE); return results; }  static Map<String, String> createNewEmptyMap(); static Map<String, String> fromException(@NotNull Exception ex); }
ResultUtils { public static Map<String, String> fromException(@NotNull Exception ex) { Map<String, String> results = createNewEmptyMap(); if (ex instanceof AbbyySdkException && ((AbbyySdkException) ex).getResultsMap() != null) { Map<String, String> map = ((AbbyySdkException) ex).getResultsMap(); for (String outputName : getOutputNames()) { if (map.containsKey(outputName)) { results.put(outputName, map.get(outputName)); } } } results.put(OutputNames.RETURN_RESULT, ex.getMessage()); results.put(OutputNames.EXCEPTION, ExceptionUtils.getStackTrace(ex)); results.put(OutputNames.RETURN_CODE, ReturnCodes.FAILURE); return results; }  static Map<String, String> createNewEmptyMap(); static Map<String, String> fromException(@NotNull Exception ex);  }