Skip to content

Commit

Permalink
Fix some ErrorProne warnings in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jan 24, 2024
1 parent 1a73d80 commit ad635f4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/test/java/edu/hm/hafner/coverage/FileNodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ void shouldGetCounters() {

@Test
void shouldAddModifiedLines() {
FileNode noModifiedLines = new FileNode("NoModified.java", ".");
FileNode modifiedLines = new FileNode("Modified.java", ".");
var noModifiedLines = new FileNode("NoModified.java", ".");
var modifiedLines = new FileNode("Modified.java", ".");

modifiedLines.addModifiedLines(1, 3, 5);

Expand Down Expand Up @@ -190,9 +190,9 @@ void shouldFilterTreeByModifiedLinesWithNoMutations() {

@Test
void shouldFilterTreeByIndirectChangesPositiveDelta() {
FileNode lineCoverage = new FileNode("lineCoverage.java", ".");
FileNode branchCoverage = new FileNode("branchCoverage.java", ".");
FileNode lineAndBranchCoverage = new FileNode("lineAndBranchCoverage.java", ".");
var lineCoverage = new FileNode("lineCoverage.java", ".");
var branchCoverage = new FileNode("branchCoverage.java", ".");
var lineAndBranchCoverage = new FileNode("lineAndBranchCoverage.java", ".");

lineCoverage.addCounters(1, 1, 0);
lineCoverage.addIndirectCoverageChange(1, 1);
Expand Down Expand Up @@ -228,9 +228,9 @@ void shouldFilterTreeByIndirectChangesPositiveDelta() {

@Test
void shouldFilterTreeByIndirectChangesNegativeDelta() {
FileNode lineCoverage = new FileNode("lineCoverage.java", ".");
FileNode branchCoverage = new FileNode("branchCoverage.java", ".");
FileNode lineAndBranchCoverage = new FileNode("lineAndBranchCoverage.java", ".");
var lineCoverage = new FileNode("lineCoverage.java", ".");
var branchCoverage = new FileNode("branchCoverage.java", ".");
var lineAndBranchCoverage = new FileNode("lineAndBranchCoverage.java", ".");

lineCoverage.addCounters(1, 1, 0);
lineCoverage.addIndirectCoverageChange(1, -1);
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/edu/hm/hafner/coverage/MetricTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ void shouldCorrectlyComputeDensityEvaluator() {

@Test
void shouldReturnEmptyOptionalOnComputeDensityEvaluator() {
Coverage zeroLines = new Coverage.CoverageBuilder().withMetric(Metric.LINE).withCovered(0).withMissed(0).build();
Coverage tenLines = new Coverage.CoverageBuilder().withMetric(Metric.LINE).withCovered(5).withMissed(5).build();
CyclomaticComplexity cyclomaticComplexity = new CyclomaticComplexity(10);
var zeroLines = new Coverage.CoverageBuilder().withMetric(Metric.LINE).withCovered(0).withMissed(0).build();
var tenLines = new Coverage.CoverageBuilder().withMetric(Metric.LINE).withCovered(5).withMissed(5).build();
var cyclomaticComplexity = new CyclomaticComplexity(10);

var onlyLinesOfCode = new PackageNode("package");
onlyLinesOfCode.addValue(tenLines);
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/edu/hm/hafner/coverage/NodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,8 @@ void shouldThrowExceptionWhenTryingToRemoveNodeThatIsNotAChild() {

@Test
void shouldReturnCorrectHasModifiedLines() {
Node packageNode = new PackageNode("package");
FileNode fileNode = new FileNode("file", ".");
var packageNode = new PackageNode("package");
var fileNode = new FileNode("file", ".");
packageNode.addChild(fileNode);

assertThat(packageNode).doesNotHaveModifiedLines();
Expand Down

0 comments on commit ad635f4

Please sign in to comment.