DependencyTreeNode.kt

1
package com.depanalyzer.report
2
3
import com.depanalyzer.parser.Ecosystem
4
import com.fasterxml.jackson.annotation.JsonIgnore
5
import com.fasterxml.jackson.annotation.JsonInclude
6
7
@JsonInclude(JsonInclude.Include.NON_NULL)
8
data class DependencyTreeNode(
9 1 1. getGroupId : replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getGroupId → KILLED
    val groupId: String,
10 1 1. getArtifactId : replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getArtifactId → KILLED
    val artifactId: String,
11 1 1. getCurrentVersion : replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getCurrentVersion → KILLED
    val currentVersion: String,
12 1 1. getLatestVersion : replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getLatestVersion → NO_COVERAGE
    val latestVersion: String? = null,
13 2 1. isDirectDependency : replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::isDirectDependency → SURVIVED
2. isDirectDependency : replaced boolean return with false for com/depanalyzer/report/DependencyTreeNode::isDirectDependency → KILLED
    val isDirectDependency: Boolean = false,
14 2 1. isDependencyManagement : replaced boolean return with false for com/depanalyzer/report/DependencyTreeNode::isDependencyManagement → NO_COVERAGE
2. isDependencyManagement : replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::isDependencyManagement → NO_COVERAGE
    val isDependencyManagement: Boolean = false,
15 1 1. getScope : replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getScope → NO_COVERAGE
    val scope: String? = null,
16 1 1. getVulnerabilities : replaced return value with Collections.emptyList for com/depanalyzer/report/DependencyTreeNode::getVulnerabilities → KILLED
    val vulnerabilities: List<Vulnerability> = emptyList(),
17 1 1. getChildren : replaced return value with Collections.emptyList for com/depanalyzer/report/DependencyTreeNode::getChildren → KILLED
    val children: List<DependencyTreeNode> = emptyList(),
18 1 1. getDependencyChain : replaced return value with Collections.emptyList for com/depanalyzer/report/DependencyTreeNode::getDependencyChain → NO_COVERAGE
    val dependencyChain: List<String>? = null,
19
    val ecosystem: Ecosystem = Ecosystem.MAVEN
20
) {
21
    @get:JsonIgnore
22 1 1. getCoordinate : replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getCoordinate → NO_COVERAGE
    val coordinate: String get() = "$groupId:$artifactId:$currentVersion"
23
24
    @get:JsonIgnore
25 2 1. getHasOutdated : replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::getHasOutdated → SURVIVED
2. getHasOutdated : negated conditional → KILLED
    val hasOutdated: Boolean get() = latestVersion != null
26
27
    @get:JsonIgnore
28 2 1. getHasVulnerabilities : negated conditional → NO_COVERAGE
2. getHasVulnerabilities : replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::getHasVulnerabilities → NO_COVERAGE
    val hasVulnerabilities: Boolean get() = vulnerabilities.isNotEmpty()
29
30
    @get:JsonIgnore
31 3 1. getHasProblems : replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::getHasProblems → NO_COVERAGE
2. getHasProblems : negated conditional → NO_COVERAGE
3. getHasProblems : negated conditional → NO_COVERAGE
    val hasProblems: Boolean get() = hasOutdated || hasVulnerabilities
32
33
    @get:JsonIgnore
34
    val maxSeverity: VulnerabilitySeverity?
35 1 1. getMaxSeverity : negated conditional → NO_COVERAGE
        get() = vulnerabilities.maxByOrNull { it.severity.ordinal }?.severity
36
37
    @get:JsonIgnore
38
    val depth: Int
39 7 1. getDepth : replaced int return with 0 for com/depanalyzer/report/DependencyTreeNode::getDepth → NO_COVERAGE
2. getDepth : Replaced integer addition with subtraction → NO_COVERAGE
3. getDepth : negated conditional → NO_COVERAGE
4. getDepth : changed conditional boundary → NO_COVERAGE
5. getDepth : negated conditional → NO_COVERAGE
6. getDepth : negated conditional → NO_COVERAGE
7. getDepth : negated conditional → NO_COVERAGE
        get() = if (children.isEmpty()) 0 else 1 + children.maxOf { it.depth }
40
41
    @JsonIgnore
42
    fun hasVulnerabilityWithSeverityOrHigher(severity: VulnerabilitySeverity): Boolean {
43 3 1. hasVulnerabilityWithSeverityOrHigher : negated conditional → NO_COVERAGE
2. hasVulnerabilityWithSeverityOrHigher : changed conditional boundary → NO_COVERAGE
3. hasVulnerabilityWithSeverityOrHigher : negated conditional → NO_COVERAGE
        if (vulnerabilities.any { it.severity.ordinal >= severity.ordinal }) {
44 1 1. hasVulnerabilityWithSeverityOrHigher : replaced boolean return with false for com/depanalyzer/report/DependencyTreeNode::hasVulnerabilityWithSeverityOrHigher → NO_COVERAGE
            return true
45
        }
46 1 1. hasVulnerabilityWithSeverityOrHigher : replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::hasVulnerabilityWithSeverityOrHigher → NO_COVERAGE
        return children.any { it.hasVulnerabilityWithSeverityOrHigher(severity) }
47
    }
48
49
    @JsonIgnore
50
    fun getProblematicDescendants(): List<DependencyTreeNode> {
51
        val result = mutableListOf<DependencyTreeNode>()
52 1 1. getProblematicDescendants : negated conditional → NO_COVERAGE
        if (hasProblems) {
53
            result.add(this)
54
        }
55
        children.forEach { child ->
56
            result.addAll(child.getProblematicDescendants())
57
        }
58 1 1. getProblematicDescendants : replaced return value with Collections.emptyList for com/depanalyzer/report/DependencyTreeNode::getProblematicDescendants → NO_COVERAGE
        return result
59
    }
60
}
61
62
enum class TreeExpandMode {
63
    COLLAPSED,
64
    CRITICAL,
65
    HIGH,
66
    MEDIUM,
67
    ALL
68
}

Mutations

9

1.1
Location : getGroupId
Killed by : com.depanalyzer.report.DependencyTreeBuilderTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.DependencyTreeBuilderTest]/[method:builds tree with only nodes that have problems()]
replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getGroupId → KILLED

10

1.1
Location : getArtifactId
Killed by : com.depanalyzer.report.DependencyTreeBuilderTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.DependencyTreeBuilderTest]/[method:respects tree depth limit()]
replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getArtifactId → KILLED

11

1.1
Location : getCurrentVersion
Killed by : com.depanalyzer.report.DependencyTreeBuilderTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.DependencyTreeBuilderTest]/[method:builds tree with only nodes that have problems()]
replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getCurrentVersion → KILLED

12

1.1
Location : getLatestVersion
Killed by : none
replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getLatestVersion → NO_COVERAGE

13

1.1
Location : isDirectDependency
Killed by : none
replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::isDirectDependency → SURVIVED
Covering tests

2.2
Location : isDirectDependency
Killed by : com.depanalyzer.report.DependencyTreeBuilderTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.DependencyTreeBuilderTest]/[method:builds tree with only nodes that have problems()]
replaced boolean return with false for com/depanalyzer/report/DependencyTreeNode::isDirectDependency → KILLED

14

1.1
Location : isDependencyManagement
Killed by : none
replaced boolean return with false for com/depanalyzer/report/DependencyTreeNode::isDependencyManagement → NO_COVERAGE

2.2
Location : isDependencyManagement
Killed by : none
replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::isDependencyManagement → NO_COVERAGE

15

1.1
Location : getScope
Killed by : none
replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getScope → NO_COVERAGE

16

1.1
Location : getVulnerabilities
Killed by : com.depanalyzer.report.DependencyTreeBuilderTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.DependencyTreeBuilderTest]/[method:builds tree with only nodes that have problems()]
replaced return value with Collections.emptyList for com/depanalyzer/report/DependencyTreeNode::getVulnerabilities → KILLED

17

1.1
Location : getChildren
Killed by : com.depanalyzer.report.DependencyTreeBuilderTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.DependencyTreeBuilderTest]/[method:respects tree depth limit()]
replaced return value with Collections.emptyList for com/depanalyzer/report/DependencyTreeNode::getChildren → KILLED

18

1.1
Location : getDependencyChain
Killed by : none
replaced return value with Collections.emptyList for com/depanalyzer/report/DependencyTreeNode::getDependencyChain → NO_COVERAGE

22

1.1
Location : getCoordinate
Killed by : none
replaced return value with "" for com/depanalyzer/report/DependencyTreeNode::getCoordinate → NO_COVERAGE

25

1.1
Location : getHasOutdated
Killed by : com.depanalyzer.report.DependencyTreeBuilderTest.[engine:junit-jupiter]/[class:com.depanalyzer.report.DependencyTreeBuilderTest]/[method:orders nodes with outdated versions first()]
negated conditional → KILLED

2.2
Location : getHasOutdated
Killed by : none
replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::getHasOutdated → SURVIVED
Covering tests

28

1.1
Location : getHasVulnerabilities
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : getHasVulnerabilities
Killed by : none
replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::getHasVulnerabilities → NO_COVERAGE

31

1.1
Location : getHasProblems
Killed by : none
replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::getHasProblems → NO_COVERAGE

2.2
Location : getHasProblems
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : getHasProblems
Killed by : none
negated conditional → NO_COVERAGE

35

1.1
Location : getMaxSeverity
Killed by : none
negated conditional → NO_COVERAGE

39

1.1
Location : getDepth
Killed by : none
replaced int return with 0 for com/depanalyzer/report/DependencyTreeNode::getDepth → NO_COVERAGE

2.2
Location : getDepth
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : getDepth
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : getDepth
Killed by : none
changed conditional boundary → NO_COVERAGE

5.5
Location : getDepth
Killed by : none
negated conditional → NO_COVERAGE

6.6
Location : getDepth
Killed by : none
negated conditional → NO_COVERAGE

7.7
Location : getDepth
Killed by : none
negated conditional → NO_COVERAGE

43

1.1
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

44

1.1
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
replaced boolean return with false for com/depanalyzer/report/DependencyTreeNode::hasVulnerabilityWithSeverityOrHigher → NO_COVERAGE

46

1.1
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
replaced boolean return with true for com/depanalyzer/report/DependencyTreeNode::hasVulnerabilityWithSeverityOrHigher → NO_COVERAGE

52

1.1
Location : getProblematicDescendants
Killed by : none
negated conditional → NO_COVERAGE

58

1.1
Location : getProblematicDescendants
Killed by : none
replaced return value with Collections.emptyList for com/depanalyzer/report/DependencyTreeNode::getProblematicDescendants → NO_COVERAGE

71

1.1
Location : getMaxSeverity
Killed by : none
negated conditional → NO_COVERAGE

73

1.1
Location : getMaxSeverity
Killed by : none
negated conditional → NO_COVERAGE

78

1.1
Location : getMaxSeverity
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : getMaxSeverity
Killed by : none
changed conditional boundary → NO_COVERAGE

82

1.1
Location : getMaxSeverity
Killed by : none
negated conditional → NO_COVERAGE

85

1.1
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

86

1.1
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

88

1.1
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

89

1.1
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : hasVulnerabilityWithSeverityOrHigher
Killed by : none
negated conditional → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.22.1