mc1arke / sonarqube-community-branch-plugin

A plugin that allows branch analysis and pull request decoration in the Community version of Sonarqube
GNU Lesser General Public License v3.0
2.26k stars 527 forks source link

#972: Ensure a consistent timezone is used in comparisons #973

Closed mc1arke closed 1 month ago

mc1arke commented 1 month ago

The service code uses DateUtils to convert a long into a String format, which DateUtils converting the long to an instant, then an OffsetDateTime before passing this through a formatter, using the local timezone during the OffsetDateTime conversion. As the test was using a pre-created String based on the UTC timezone, the test does not correctly compare the values when being executed in a different timezone. To overcome this, the test has been altered to use the same DateUtils methods to convert from the long to a String, thereby ensuring the same timezone handling is using in both test and live code.

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud