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

Ekryd / echo-maven-plugin / 3648

14 Nov 2024 01:38PM CUT coverage: 96.795%. Remained the same
3648

push

circleci

web-flow
Update dependency org.codehaus.mojo:versions-maven-plugin to v2.18.0

302 of 312 relevant lines covered (96.79%)

0.97 hits per line

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

100.0
/echo/src/main/java/echo/parameter/OutputLevelType.java
1
package echo.parameter;
2

3
import echo.exception.FailureException;
4
import java.util.Locale;
5
import java.util.function.Function;
6

7
/** Defines the different levels a message can be output to. INFO is the default level */
8
public enum OutputLevelType {
1✔
9
  FAIL(name -> "FAIL".equals(name) || "FATAL".equals(name)),
1✔
10
  ERROR("ERROR"::equals),
1✔
11
  WARNING(name -> "WARNING".equals(name) || "WARN".equals(name)),
1✔
12
  INFO("INFO"::equals),
1✔
13
  DEBUG(name -> "DEBUG".equals(name) || "TRACE".equals(name));
1✔
14

15
  private final Function<String, Boolean> matchName;
16

17
  private static final String ERROR_LEVEL_MSG =
18
      "level must be either FAIL, ERROR, WARNING, INFO or DEBUG.";
19

20
  OutputLevelType(Function<String, Boolean> matchName) {
1✔
21
    this.matchName = matchName;
1✔
22
  }
1✔
23

24
  /** Converts a string to the corresponding context */
25
  static OutputLevelType fromString(String level) {
26
    if (level == null) {
1✔
27
      throw new FailureException(ERROR_LEVEL_MSG + " Was: null");
1✔
28
    }
29
    var upperCaseLevel = level.toUpperCase(Locale.getDefault());
1✔
30
    for (var outputLevelType : values()) {
1✔
31
      if (Boolean.TRUE.equals(outputLevelType.matchName.apply(upperCaseLevel))) {
1✔
32
        return outputLevelType;
1✔
33
      }
34
    }
35
    throw new FailureException(ERROR_LEVEL_MSG + " Was: " + level);
1✔
36
  }
37
}
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