From a5b8d3a03450d67078fbdd4a42003a83e456e78a Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Wed, 9 Oct 2024 09:54:01 -0400 Subject: [PATCH] Override `assignBuildNumber` rather than `saveNextBuildNumber` --- .../AbstractJaCoCoCoverageColumnTest.java | 12 +++++++----- .../BranchCoverageColumnTest.java | 7 ++++--- .../jacococoveragecolumn/JaCoCoColumnTest.java | 7 ++++--- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/test/java/hudson/plugins/jacococoveragecolumn/AbstractJaCoCoCoverageColumnTest.java b/src/test/java/hudson/plugins/jacococoveragecolumn/AbstractJaCoCoCoverageColumnTest.java index db71d6f6..8574f60f 100644 --- a/src/test/java/hudson/plugins/jacococoveragecolumn/AbstractJaCoCoCoverageColumnTest.java +++ b/src/test/java/hudson/plugins/jacococoveragecolumn/AbstractJaCoCoCoverageColumnTest.java @@ -89,9 +89,10 @@ public MyRun getLastSuccessfulBuild() { } } - @Override - protected synchronized void saveNextBuildNumber() { - } + @Override + public int assignBuildNumber() throws IOException { + return nextBuildNumber++; + } }; assertTrue(abstractJaCoCoCoverageColumn.hasCoverage(mockJob)); assertEquals("66.67", abstractJaCoCoCoverageColumn.getPercent(mockJob)); @@ -218,8 +219,9 @@ public MyRun getLastSuccessfulBuild() { } @Override - protected synchronized void saveNextBuildNumber() { - } + public int assignBuildNumber() throws IOException { + return nextBuildNumber++; + } } private class MyJob extends Job { diff --git a/src/test/java/hudson/plugins/jacococoveragecolumn/BranchCoverageColumnTest.java b/src/test/java/hudson/plugins/jacococoveragecolumn/BranchCoverageColumnTest.java index 44e30b21..443c435b 100644 --- a/src/test/java/hudson/plugins/jacococoveragecolumn/BranchCoverageColumnTest.java +++ b/src/test/java/hudson/plugins/jacococoveragecolumn/BranchCoverageColumnTest.java @@ -58,9 +58,10 @@ public MyRun getLastSuccessfulBuild() { } } - @Override - protected synchronized void saveNextBuildNumber() { - } + @Override + public int assignBuildNumber() throws IOException { + return nextBuildNumber++; + } }; assertEquals("66.67", sut.getPercent(mockJob)); diff --git a/src/test/java/hudson/plugins/jacococoveragecolumn/JaCoCoColumnTest.java b/src/test/java/hudson/plugins/jacococoveragecolumn/JaCoCoColumnTest.java index 4fb3fb95..6779000c 100644 --- a/src/test/java/hudson/plugins/jacococoveragecolumn/JaCoCoColumnTest.java +++ b/src/test/java/hudson/plugins/jacococoveragecolumn/JaCoCoColumnTest.java @@ -57,9 +57,10 @@ public MyRun getLastSuccessfulBuild() { } } - @Override - protected synchronized void saveNextBuildNumber() { - } + @Override + public int assignBuildNumber() throws IOException { + return nextBuildNumber++; + } }; assertTrue(jaCoCoColumn.hasCoverage(mockJob)); assertEquals("33.33", jaCoCoColumn.getPercent(mockJob));