• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

fslev / cucumber-jutils / #130

24 Oct 2023 10:28AM UTC coverage: 95.76%. Remained the same
#130

push

web-flow
Merge ce6bdc02f into 319398db5

271 of 283 relevant lines covered (95.76%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/main/java/com/cucumber/utils/context/vars/internal/SpELParser.java
1
package com.cucumber.utils.context.vars.internal;
2

3
import org.apache.logging.log4j.LogManager;
4
import org.apache.logging.log4j.Logger;
5
import org.springframework.expression.Expression;
6
import org.springframework.expression.ParserContext;
7
import org.springframework.expression.spel.standard.SpelExpressionParser;
8

9
public class SpELParser {
10

11
    private SpELParser() {
12

13
    }
14

15
    private static final Logger LOG = LogManager.getLogger();
1✔
16
    private static final SpelExpressionParser SPEL_EXPRESSION_PARSER = new SpelExpressionParser();
1✔
17

18
    public static Object parseQuietly(String source) {
19
        if (source.contains(ParserContext.TEMPLATE_EXPRESSION.getExpressionPrefix()) &&
1✔
20
                source.contains(ParserContext.TEMPLATE_EXPRESSION.getExpressionSuffix())) {
1✔
21
            try {
22
                Expression exp = SPEL_EXPRESSION_PARSER.parseExpression(source, ParserContext.TEMPLATE_EXPRESSION);
1✔
23
                return exp.getValue(Object.class);
1✔
24
            } catch (Exception e) {
1✔
25
                LOG.warn("Found invalid SpEL expressions:\n{}", e.getMessage());
1✔
26
            }
27
        }
28
        return source;
1✔
29
    }
30
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc