@Test(dataProvider = "abbreviateDP") public void abbreviate(String input, int maxLength, Boolean removeWhitespaces, String expectedOutput) { AbbreviateFunction abbreviateFunction = new AbbreviateFunction(); assertEquals(abbreviateFunction.execute(Arrays.asList(input, new BigDecimal(maxLength), removeWhitespaces)), expectedOutput); }
@Override protected Object execute(List<Object> arguments) { String toAbbreviate = (String) arguments.get(0); BigDecimal summaryMaxLength = (BigDecimal) arguments.get(1); boolean removeLeadingWhitespaces = Optional.ofNullable((Boolean) arguments.get(2)).orElse(false); toAbbreviate = removeLeadingWhitespaces && toAbbreviate != null ? toAbbreviate.replaceAll("(?m)^[\\s\\t]+|\\n", "") : toAbbreviate; return StringUtils.abbreviate(toAbbreviate, summaryMaxLength.intValue()); }
AbbreviateFunction extends AbstractFunction { @Override protected Object execute(List<Object> arguments) { String toAbbreviate = (String) arguments.get(0); BigDecimal summaryMaxLength = (BigDecimal) arguments.get(1); boolean removeLeadingWhitespaces = Optional.ofNullable((Boolean) arguments.get(2)).orElse(false); toAbbreviate = removeLeadingWhitespaces && toAbbreviate != null ? toAbbreviate.replaceAll("(?m)^[\\s\\t]+|\\n", "") : toAbbreviate; return StringUtils.abbreviate(toAbbreviate, summaryMaxLength.intValue()); } }
AbbreviateFunction extends AbstractFunction { @Override protected Object execute(List<Object> arguments) { String toAbbreviate = (String) arguments.get(0); BigDecimal summaryMaxLength = (BigDecimal) arguments.get(1); boolean removeLeadingWhitespaces = Optional.ofNullable((Boolean) arguments.get(2)).orElse(false); toAbbreviate = removeLeadingWhitespaces && toAbbreviate != null ? toAbbreviate.replaceAll("(?m)^[\\s\\t]+|\\n", "") : toAbbreviate; return StringUtils.abbreviate(toAbbreviate, summaryMaxLength.intValue()); }  }
AbbreviateFunction extends AbstractFunction { @Override protected Object execute(List<Object> arguments) { String toAbbreviate = (String) arguments.get(0); BigDecimal summaryMaxLength = (BigDecimal) arguments.get(1); boolean removeLeadingWhitespaces = Optional.ofNullable((Boolean) arguments.get(2)).orElse(false); toAbbreviate = removeLeadingWhitespaces && toAbbreviate != null ? toAbbreviate.replaceAll("(?m)^[\\s\\t]+|\\n", "") : toAbbreviate; return StringUtils.abbreviate(toAbbreviate, summaryMaxLength.intValue()); }  @Override String name(); }
AbbreviateFunction extends AbstractFunction { @Override protected Object execute(List<Object> arguments) { String toAbbreviate = (String) arguments.get(0); BigDecimal summaryMaxLength = (BigDecimal) arguments.get(1); boolean removeLeadingWhitespaces = Optional.ofNullable((Boolean) arguments.get(2)).orElse(false); toAbbreviate = removeLeadingWhitespaces && toAbbreviate != null ? toAbbreviate.replaceAll("(?m)^[\\s\\t]+|\\n", "") : toAbbreviate; return StringUtils.abbreviate(toAbbreviate, summaryMaxLength.intValue()); }  @Override String name();  }