This is an automated email from the ASF dual-hosted git repository.

ashishvijaywargiya pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c479b5a60 Fix CodeNarc violations in scrum and assetmaint Jupiter test 
fixtures (#375)
c479b5a60 is described below

commit c479b5a603a358b4b59de083420c90e77f2878b0
Author: Ashish Vijaywargiya <[email protected]>
AuthorDate: Sat Aug 22 22:06:55 2026 +0530

    Fix CodeNarc violations in scrum and assetmaint Jupiter test fixtures (#375)
    
    Use BigDecimal instead of Double for plan/actual hours in MyWorkTests,
    matching the underlying service field types and fixing the NoDouble rule
    violation.
    
    Suppress PublicMethodsBeforeNonPublicMethods and
    JUnitTestMethodWithoutAssert in MyWorkTests, ProductBacklogTests,
    ScrumProjectTests, and FixedAssetMaintTests. Both are false positives
    here: the flagged test methods delegate to a private helper that holds
    the real assertion, a pattern CodeNarc doesn't trace into.
---
 .../ofbiz/assetmaint/assetmaint/test/FixedAssetMaintTests.groovy     | 1 +
 scrum/src/test/groovy/org/apache/ofbiz/scrum/test/MyWorkTests.groovy | 5 +++--
 .../groovy/org/apache/ofbiz/scrum/test/ProductBacklogTests.groovy    | 1 +
 .../test/groovy/org/apache/ofbiz/scrum/test/ScrumProjectTests.groovy | 1 +
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/assetmaint/src/test/groovy/org/apache/ofbiz/assetmaint/assetmaint/test/FixedAssetMaintTests.groovy
 
b/assetmaint/src/test/groovy/org/apache/ofbiz/assetmaint/assetmaint/test/FixedAssetMaintTests.groovy
index 45e27af48..5097e97a0 100644
--- 
a/assetmaint/src/test/groovy/org/apache/ofbiz/assetmaint/assetmaint/test/FixedAssetMaintTests.groovy
+++ 
b/assetmaint/src/test/groovy/org/apache/ofbiz/assetmaint/assetmaint/test/FixedAssetMaintTests.groovy
@@ -28,6 +28,7 @@ import org.junit.jupiter.api.Test
 import java.sql.Timestamp
 
 @JunitJupiterTest
+@SuppressWarnings(['PublicMethodsBeforeNonPublicMethods', 
'JUnitTestMethodWithoutAssert'])
 class FixedAssetMaintTests implements JupiterTestHelper {
 
     // Shared by testCreateFixedAssetMaintUpdateWorkEffortWithProductMaint and
diff --git 
a/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/MyWorkTests.groovy 
b/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/MyWorkTests.groovy
index e30a94b9f..8ca2d2b96 100644
--- a/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/MyWorkTests.groovy
+++ b/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/MyWorkTests.groovy
@@ -27,6 +27,7 @@ import org.junit.jupiter.api.Order
 import org.junit.jupiter.api.Test
 
 @JunitJupiterTest
+@SuppressWarnings(['PublicMethodsBeforeNonPublicMethods', 
'JUnitTestMethodWithoutAssert'])
 class MyWorkTests implements JupiterTestHelper {
 
     // Shared by testUpdateTimesheetEntryByWorkeffortNotComplete/Complete 
below - identical apart
@@ -34,8 +35,8 @@ class MyWorkTests implements JupiterTestHelper {
     private void updateTimesheetEntryByWorkeffort(String defaultCheckComplete) 
{
         String timesheetId = testParams.timesheetId ?: 'DEMO-TIMESHEET1'
         String workEffortId = testParams.workEffortId ?: 'DEMO-TASK-1'
-        Double planHours = (testParams.planHours ?: 2.0d) as Double
-        Double hoursDay0 = (testParams.hoursDay0 ?: 1.0d) as Double
+        BigDecimal planHours = (testParams.planHours ?: 2.0) as BigDecimal
+        BigDecimal hoursDay0 = (testParams.hoursDay0 ?: 1.0) as BigDecimal
         String checkComplete = testParams.checkComplete ?: defaultCheckComplete
         Map serviceCtx = [
                 timesheetId: timesheetId,
diff --git 
a/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/ProductBacklogTests.groovy 
b/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/ProductBacklogTests.groovy
index 4f378a5c3..2e79b9540 100644
--- 
a/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/ProductBacklogTests.groovy
+++ 
b/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/ProductBacklogTests.groovy
@@ -26,6 +26,7 @@ import org.junit.jupiter.api.Order
 import org.junit.jupiter.api.Test
 
 @JunitJupiterTest
+@SuppressWarnings(['PublicMethodsBeforeNonPublicMethods', 
'JUnitTestMethodWithoutAssert'])
 class ProductBacklogTests implements JupiterTestHelper {
 
     @Test
diff --git 
a/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/ScrumProjectTests.groovy 
b/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/ScrumProjectTests.groovy
index f37a1321b..5c4c56383 100644
--- a/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/ScrumProjectTests.groovy
+++ b/scrum/src/test/groovy/org/apache/ofbiz/scrum/test/ScrumProjectTests.groovy
@@ -25,6 +25,7 @@ import org.junit.jupiter.api.Order
 import org.junit.jupiter.api.Test
 
 @JunitJupiterTest
+@SuppressWarnings(['PublicMethodsBeforeNonPublicMethods', 
'JUnitTestMethodWithoutAssert'])
 class ScrumProjectTests implements JupiterTestHelper {
 
     // Migrated from ScrumProjectTests.xml:testCreateScrumProjectByProductOwner

Reply via email to