1 | package sh.okx.rankup.text.pebble; | |
2 | ||
3 | import com.mitchellbosecke.pebble.error.PebbleException; | |
4 | import com.mitchellbosecke.pebble.extension.Filter; | |
5 | import com.mitchellbosecke.pebble.template.EvaluationContext; | |
6 | import com.mitchellbosecke.pebble.template.PebbleTemplate; | |
7 | import java.util.List; | |
8 | import java.util.Map; | |
9 | import sh.okx.rankup.placeholders.Placeholders; | |
10 | ||
11 | public class MoneyShortFilter implements Filter { | |
12 | ||
13 | private final Placeholders placeholders; | |
14 | ||
15 | public MoneyShortFilter(Placeholders placeholders) { | |
16 | this.placeholders = placeholders; | |
17 | } | |
18 | ||
19 | @Override | |
20 | public List<String> getArgumentNames() { | |
21 |
1
1. getArgumentNames : replaced return value with Collections.emptyList for sh/okx/rankup/text/pebble/MoneyShortFilter::getArgumentNames → NO_COVERAGE |
return null; |
22 | } | |
23 | ||
24 | @Override | |
25 | public Object apply(Object input, Map<String, Object> args, PebbleTemplate self, | |
26 | EvaluationContext context, int lineNumber) throws PebbleException { | |
27 |
1
1. apply : negated conditional → NO_COVERAGE |
if (input == null) { |
28 | return null; | |
29 | } | |
30 |
1
1. apply : negated conditional → NO_COVERAGE |
if (!(input instanceof Number)) { |
31 | throw new PebbleException(null, "The input for the 'MoneyShortFilter' filter has to be a number: " + input, | |
32 | lineNumber, self.getName()); | |
33 | } | |
34 | ||
35 | Number number = (Number) input; | |
36 |
1
1. apply : replaced return value with null for sh/okx/rankup/text/pebble/MoneyShortFilter::apply → NO_COVERAGE |
return placeholders.formatMoney(number.doubleValue()); |
37 | } | |
38 | } | |
Mutations | ||
21 |
1.1 |
|
27 |
1.1 |
|
30 |
1.1 |
|
36 |
1.1 |