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

jleroux 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 21aff950e Fixed: Fix Assetmain Groovy tests (OFBIZ-13003)
21aff950e is described below

commit 21aff950ea312d20df33aebda2dd25053792f797
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Sun Apr 7 13:40:40 2024 +0200

    Fixed: Fix Assetmain Groovy tests (OFBIZ-13003)
    
    Fixes the Unable to load test suite class : FixedAssetMaintTests  issue
    Fixes also few Codenarc minor issues.
    
    Remain some other issues...
    [JUNIT (error)] - testUpdateFixedAssetMaintAndWorkEffort :
    java.lang.NullPointerException: Cannot get property 'scheduleWorkEffortId'
    on null object
    
    testUpdateFixedAssetMaintAndWorkEffortComplete : Cannot get property
    'fixedAssetId' on null object
    
    testUpdateFixedAssetMaintAndWorkEffort : Cannot get property
    scheduleWorkEffortId on null object
---
 .../assetmaint}/assetmaint/test/FixedAssetMaintTests.groovy   | 11 ++++++-----
 assetmaint/testdef/assetmainttests.xml                        |  4 ++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git 
a/assetmaint/src/test/groovy/org/apache/assetmaint-plugins/assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/test/FixedAssetMaintTests.groovy
 
b/assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/assetmaint/test/FixedAssetMaintTests.groovy
similarity index 97%
rename from 
assetmaint/src/test/groovy/org/apache/assetmaint-plugins/assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/test/FixedAssetMaintTests.groovy
rename to 
assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/assetmaint/test/FixedAssetMaintTests.groovy
index bfe08c0bb..5a9735cc3 100644
--- 
a/assetmaint/src/test/groovy/org/apache/assetmaint-plugins/assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/test/FixedAssetMaintTests.groovy
+++ 
b/assetmaint/src/main/groovy/org/apache/ofbiz/assetmaint/assetmaint/test/FixedAssetMaintTests.groovy
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.ofbiz.assetmaint.test
+package org.apache.ofbiz.assetmaint.assetmaint.test
 
 import java.sql.Timestamp
 import java.text.SimpleDateFormat
@@ -26,13 +26,14 @@ import org.apache.ofbiz.entity.GenericValue
 import org.apache.ofbiz.service.testtools.OFBizTestCase
 
 class FixedAssetMaintTests extends OFBizTestCase {
+
     public FixedAssetMaintTests(String name) {
         super(name)
     }
 
     void testCreateFixedAssetMaintUpdateWorkEffortWithProductMaint() {
         // Test case for service createFixedAssetMaintUpdateWorkEffort with a 
product Maintenance
-        SimpleDateFormat sdf = new SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSS')
+        SimpleDateFormat sdf = new SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSS', 
Locale.getDefault())
         String fixedAssetId = 'DEMO_VEHICLE_01'
         Map serviceCtx = [fixedAssetId: fixedAssetId,
                           statusId: 'FAM_CREATED',
@@ -57,10 +58,9 @@ class FixedAssetMaintTests extends OFBizTestCase {
         assert workEffort.estimatedCompletionDate == 
serviceCtx.estimatedCompletionDate
         assert workEffort.actualStartDate == serviceCtx.actualStartDate
     }
-
     void testCreateFixedAssetMaintUpdateWorkEffortWithoutProductMaint() {
         // Test case for service createFixedAssetMaintUpdateWorkEffort without 
a product maintenance
-        SimpleDateFormat sdf = new SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSS')
+        SimpleDateFormat sdf = new SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSS', 
Locale.getDefault())
         String fixedAssetId = 'DEMO_VEHICLE_01'
         Map serviceCtx = [fixedAssetId: fixedAssetId,
                           statusId: 'FAM_CREATED',
@@ -91,7 +91,7 @@ class FixedAssetMaintTests extends OFBizTestCase {
 
     void testUpdateFixedAssetMaintAndWorkEffort() {
         // Test case for service updateFixedAssetMaintAndWorkEffort
-        SimpleDateFormat sdf = new SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSS')
+        SimpleDateFormat sdf = new SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSS', 
Locale.getDefault())
         String fixedAssetId = 'DEMO_VEHICLE_01'
         String maintHistSeqId = '00001'    // Sequence created by 
testCreateFixedAssetMaintUpdateWorkEffortWithProductMaint
         GenericValue fixedAssetMaint = from('FixedAssetMaint')
@@ -140,4 +140,5 @@ class FixedAssetMaintTests extends OFBizTestCase {
         assert workEffort.currentStatusId == 'CAL_COMPLETED'
         assert workEffort.actualCompletionDate == 
serviceCtx.actualCompletionDate
     }
+
 }
diff --git a/assetmaint/testdef/assetmainttests.xml 
b/assetmaint/testdef/assetmainttests.xml
index bb3ed16ec..8300b0a05 100644
--- a/assetmaint/testdef/assetmainttests.xml
+++ b/assetmaint/testdef/assetmainttests.xml
@@ -22,7 +22,7 @@
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd";>
 
-    <test-case case-name="assetmaint-tests">
-        <junit-test-suite 
class-name="org.apache.ofbiz.assetmaint.test.FixedAssetMaintTests"/>
+<test-case case-name="assetmaint-tests">
+        <junit-test-suite 
class-name="org.apache.ofbiz.assetmaint.assetmaint.test.FixedAssetMaintTests"/>
     </test-case>
 </test-suite>

Reply via email to