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

devonfw / IDEasy / 12125578396

02 Dec 2024 06:25PM UTC coverage: 67.265% (+0.3%) from 67.008%
12125578396

push

github

web-flow
#824: fix git url with branch (#828)

2509 of 4080 branches covered (61.5%)

Branch coverage included in aggregate %.

6565 of 9410 relevant lines covered (69.77%)

3.08 hits per line

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

78.95
cli/src/main/java/com/devonfw/tools/ide/process/ProcessResultImpl.java
1
package com.devonfw.tools.ide.process;
2

3
import java.util.Collections;
4
import java.util.List;
5
import java.util.Objects;
6

7
import com.devonfw.tools.ide.cli.CliProcessException;
8
import com.devonfw.tools.ide.context.IdeContext;
9
import com.devonfw.tools.ide.log.IdeLogLevel;
10

11
/**
12
 * Implementation of {@link ProcessResult}.
13
 */
14
public class ProcessResultImpl implements ProcessResult {
15

16
  private final String executable;
17

18
  private final String command;
19

20
  private final int exitCode;
21

22
  private final List<String> out;
23

24
  private final List<String> err;
25

26
  /**
27
   * The constructor.
28
   *
29
   * @param executable the {@link #getExecutable() executable}.
30
   * @param command the {@link #getCommand() command}.
31
   * @param exitCode the {@link #getExitCode() exit code}.
32
   * @param out the {@link #getOut() out}.
33
   * @param err the {@link #getErr() err}.
34
   */
35
  public ProcessResultImpl(String executable, String command, int exitCode, List<String> out, List<String> err) {
36

37
    super();
2✔
38
    this.executable = executable;
3✔
39
    this.command = command;
3✔
40
    this.exitCode = exitCode;
3✔
41
    this.out = Objects.requireNonNullElse(out, Collections.emptyList());
6✔
42
    this.err = Objects.requireNonNullElse(err, Collections.emptyList());
6✔
43
  }
1✔
44

45
  @Override
46
  public String getExecutable() {
47

48
    return this.executable;
×
49
  }
50

51
  @Override
52
  public String getCommand() {
53

54
    return this.command;
3✔
55
  }
56

57
  @Override
58
  public int getExitCode() {
59

60
    return this.exitCode;
3✔
61
  }
62

63
  @Override
64
  public List<String> getOut() {
65

66
    return this.out;
3✔
67
  }
68

69
  @Override
70
  public List<String> getErr() {
71

72
    return this.err;
3✔
73
  }
74

75
  @Override
76
  public void log(IdeLogLevel level, IdeContext context) {
77
    log(level, context, level);
5✔
78
  }
1✔
79

80
  @Override
81
  public void log(IdeLogLevel outLevel, IdeContext context, IdeLogLevel errorLevel) {
82

83
    if (!this.out.isEmpty()) {
4✔
84
      doLog(outLevel, this.out, context);
6✔
85
    }
86
    if (!this.err.isEmpty()) {
4✔
87
      doLog(errorLevel, this.err, context);
6✔
88
    }
89
  }
1✔
90

91
  private void doLog(IdeLogLevel level, List<String> lines, IdeContext context) {
92
    for (String line : lines) {
10✔
93
      // remove !MESSAGE from log message
94
      if (line.startsWith("!MESSAGE ")) {
4!
95
        line = line.substring(9);
×
96
      }
97
      context.level(level).log(line);
5✔
98
    }
1✔
99
  }
1✔
100

101
  @Override
102
  public void failOnError() throws CliProcessException {
103

104
    if (!isSuccessful()) {
×
105
      throw new CliProcessException(this);
×
106
    }
107
  }
×
108
}
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