mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-02-23 14:29:01 +00:00
Test refactor
This commit is contained in:
parent
0def3d5a72
commit
1fba4ff265
@ -79,27 +79,7 @@ public class TestUtil {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Set some system properties randomly after each test.. this is kind of hackish,
|
||||
* but it helps us make sure we don't have any tests that depend on a particular
|
||||
* environment
|
||||
*/
|
||||
Locale[] availableLocales = { Locale.CANADA, Locale.GERMANY, Locale.TAIWAN };
|
||||
Locale.setDefault(availableLocales[(int) (Math.random() * availableLocales.length)]);
|
||||
ourLog.info("Tests are running in locale: " + Locale.getDefault().getDisplayName());
|
||||
if (Math.random() < 0.5) {
|
||||
ourLog.info("Tests are using WINDOWS line endings and ISO-8851-1");
|
||||
System.setProperty("file.encoding", "ISO-8859-1");
|
||||
System.setProperty("line.separator", "\r\n");
|
||||
} else {
|
||||
ourLog.info("Tests are using UNIX line endings and UTF-8");
|
||||
System.setProperty("file.encoding", "UTF-8");
|
||||
System.setProperty("line.separator", "\n");
|
||||
}
|
||||
String availableTimeZones[] = { "GMT+08:00", "GMT-05:00", "GMT+00:00", "GMT+03:30" };
|
||||
String timeZone = availableTimeZones[(int) (Math.random() * availableTimeZones.length)];
|
||||
TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
|
||||
ourLog.info("Tests are using time zone: {}", TimeZone.getDefault().getID());
|
||||
randomizeLocale();
|
||||
|
||||
/*
|
||||
* If we're running a CI build, set all loggers to TRACE level to ensure coverage
|
||||
@ -116,4 +96,28 @@ public class TestUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set some system properties randomly after each test.. this is kind of hackish,
|
||||
* but it helps us make sure we don't have any tests that depend on a particular
|
||||
* environment
|
||||
*/
|
||||
public static void randomizeLocale() {
|
||||
Locale[] availableLocales = { Locale.CANADA, Locale.GERMANY, Locale.TAIWAN };
|
||||
Locale.setDefault(availableLocales[(int) (Math.random() * availableLocales.length)]);
|
||||
ourLog.info("Tests are running in locale: " + Locale.getDefault().getDisplayName());
|
||||
if (Math.random() < 0.5) {
|
||||
ourLog.info("Tests are using WINDOWS line endings and ISO-8851-1");
|
||||
System.setProperty("file.encoding", "ISO-8859-1");
|
||||
System.setProperty("line.separator", "\r\n");
|
||||
} else {
|
||||
ourLog.info("Tests are using UNIX line endings and UTF-8");
|
||||
System.setProperty("file.encoding", "UTF-8");
|
||||
System.setProperty("line.separator", "\n");
|
||||
}
|
||||
String availableTimeZones[] = { "GMT+08:00", "GMT-05:00", "GMT+00:00", "GMT+03:30" };
|
||||
String timeZone = availableTimeZones[(int) (Math.random() * availableTimeZones.length)];
|
||||
TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
|
||||
ourLog.info("Tests are using time zone: {}", TimeZone.getDefault().getID());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user