Skip to content

Commit

Permalink
Merge pull request #351 from code-arnab/fix-timezoneIssue
Browse files Browse the repository at this point in the history
Fixed TimeZone test case Issue in different environments
  • Loading branch information
StefanSpieker authored Jan 12, 2025
2 parents 5fc693d + fff0c37 commit fd899fa
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.SortedMap;
import java.util.TimeZone;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicReference;

Expand Down Expand Up @@ -153,6 +154,9 @@ File getRootDir(XmlFile xmlFile,
@Test
public void testGetIdFormatter() {
SimpleDateFormat result = FileHistoryDao.getIdFormatter();
// setting a default timezone to avoid timezone issues in different environments
result.setTimeZone(TimeZone.getTimeZone("UTC"));

final String formattedDate = result.format(new Date(0));
// workaround for timezone issues, as cloudbees is in the far east :-)
// and returns 1969 :-).
Expand Down

0 comments on commit fd899fa

Please sign in to comment.