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

devonfw / IDEasy / 25378019331

05 May 2026 01:03PM UTC coverage: 71.041% (+0.4%) from 70.657%
25378019331

Pull #1826

github

web-flow
Merge eb21f872f into 2e54dfef7
Pull Request #1826: Add deterministic archive generation and checksum verification tests

4422 of 6880 branches covered (64.27%)

Branch coverage included in aggregate %.

11413 of 15410 relevant lines covered (74.06%)

3.13 hits per line

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

82.81
cli/src/main/java/com/devonfw/tools/ide/tool/ToolEditionAndVersion.java
1
package com.devonfw.tools.ide.tool;
2

3
import com.devonfw.tools.ide.version.GenericVersionRange;
4
import com.devonfw.tools.ide.version.VersionIdentifier;
5

6
/**
7
 * Container for a {@link ToolEdition} together with its version.
8
 */
9
public class ToolEditionAndVersion {
1✔
10

11
  private ToolEdition edition;
12

13
  private GenericVersionRange version;
14

15
  private VersionIdentifier resolvedVersion;
16

17
  /**
18
   * The constructor.
19
   *
20
   * @param edition the {@link #getEdition() edition}.
21
   */
22
  public ToolEditionAndVersion(ToolEdition edition) {
23
    super();
2✔
24
    this.edition = edition;
3✔
25
  }
1✔
26

27
  /**
28
   * The constructor.
29
   *
30
   * @param version the {@link #getVersion() version}.
31
   */
32
  public ToolEditionAndVersion(GenericVersionRange version) {
33
    super();
2✔
34
    if (version != null) {
2✔
35
      setVersion(version);
3✔
36
    }
37
  }
1✔
38

39
  /**
40
   * The constructor.
41
   *
42
   * @param edition the {@link #getEdition() edition}.
43
   * @param version the {@link #getVersion() version}.
44
   */
45
  public ToolEditionAndVersion(ToolEdition edition, GenericVersionRange version) {
46
    this(version);
3✔
47
    assert edition != null;
3!
48
    assert version != null;
3!
49
    this.edition = edition;
3✔
50
  }
1✔
51

52
  /**
53
   * @return the {@link ToolEdition}.
54
   */
55
  public ToolEdition getEdition() {
56

57
    return this.edition;
3✔
58
  }
59

60
  /**
61
   * @param edition new value of {@link #getEdition()}.
62
   */
63
  public void setEdition(ToolEdition edition) {
64

65
    if (this.edition != null) {
3!
66
      throw new IllegalStateException();
×
67
    }
68
    this.edition = edition;
3✔
69
  }
1✔
70

71
    /**
72
   * @param edition new value of {@link #getEdition()}.
73
   */
74
  public void replaceEdition(ToolEdition edition) {
75

76
    this.edition = edition;
3✔
77
  }
1✔
78

79
  /**
80
   * @return the {@link GenericVersionRange} that is installed or configured.
81
   */
82
  public GenericVersionRange getVersion() {
83

84
    return this.version;
3✔
85
  }
86

87
  /**
88
   * @param version new value of {@link #getVersion()}.
89
   */
90
  public void setVersion(GenericVersionRange version) {
91
    if (this.version != null) {
3!
92
      throw new IllegalStateException();
×
93
    }
94
    this.version = version;
3✔
95
    if ((this.resolvedVersion == null) && (version instanceof VersionIdentifier vi)) {
9!
96
      if (!vi.isPattern()) {
3✔
97
        this.resolvedVersion = vi;
3✔
98
      }
99
    }
100
  }
1✔
101

102
  /**
103
   * @return the resolved {@link VersionIdentifier}.
104
   */
105
  public VersionIdentifier getResolvedVersion() {
106
    return this.resolvedVersion;
3✔
107
  }
108

109
  /**
110
   * @param resolvedVersion new value of {@link #getResolvedVersion()}.
111
   */
112
  public void setResolvedVersion(VersionIdentifier resolvedVersion) {
113

114
    if ((resolvedVersion == null) || resolvedVersion.isPattern()) {
5!
115
      throw new IllegalStateException();
×
116
    }
117
    this.resolvedVersion = resolvedVersion;
3✔
118
  }
1✔
119

120
  @Override
121
  public String toString() {
122

123
    if (this.edition == null) {
3✔
124
      return "<none>";
2✔
125
    }
126
    if ((this.resolvedVersion == null) || (this.resolvedVersion == this.version)) {
8!
127
      return this.edition + "@" + this.version;
8✔
128
    }
129
    return this.edition + "@" + this.resolvedVersion + "[" + this.version + "]";
11✔
130
  }
131
}
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

© 2026 Coveralls, Inc