diff --git a/test/functions/lsWeek.cfc b/test/functions/lsWeek.cfc index c7f5b9b13b..5527a2f2e7 100644 --- a/test/functions/lsWeek.cfc +++ b/test/functions/lsWeek.cfc @@ -3,10 +3,20 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { describe( title="Testcase for lsWeek()", body=function() { it(title="checking lsWeek() with locale argument", body = function( currentSpec ) { var date = createDateTime(2022,01,17,12,0,0,0,"UTC"); - // in Arabic (Yemen) Saturday is the first day of the week - expect(lsWeek(date=date, locale="Arabic (Yemen)")).tobe(3); - // in Catalan Monday is the first day of the week - expect(lsWeek(date=date, locale="Catalan")).tobe(3); + + if(getJavaVersion()<=8){ + // in Arabic (Yemen) Saturday is the first day of the week + expect(lsWeek(date=date, locale="Arabic (Yemen)")).tobe(3); + // in Catalan Monday is the first day of the week + expect(lsWeek(date=date, locale="Catalan")).tobe(3); + }else{ + // after Java 8 in Arabic (Yemen) Sunday is the first day of the week + expect(lsWeek(date=date, locale="Arabic (Yemen)")).tobe(4); + // after Java 8 in Catalan Sunday is the first day of the week + expect(lsWeek(date=date, locale="Catalan")).tobe(4); + // Testing Iraq because it still has Saturday as the first day of the week after Java 8 + expect(lsWeek(date =date, locale="ar_IQ")).toBe(3); + } // in English (Canada) Sunday is the first day of the week expect(lsWeek(date=date, locale="English (Canada)")).tobe(4); }); @@ -21,4 +31,13 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { }); }); } + + private function getJavaVersion() { + var raw=server.java.version; + var arr=listToArray(raw,'.'); + if(arr[1]==1) // version 1-9 + return arr[2]; + return arr[1]; + } + }