Package ca.uhn.fhir.util
Class TestUtil
- java.lang.Object
-
- ca.uhn.fhir.util.TestUtil
-
-
Constructor Summary
Constructors Constructor Description TestUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearAllStaticFieldsForUnitTest()THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODEstatic voidrandomizeLocale()Set some system properties randomly after each test..static voidsetShouldRandomizeTimezones(boolean theShouldRandomizeTimezones)static StringstripReturns(String theString)THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODEstatic StringstripWhitespace(String theString)THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODEstatic voidwaitForSize(int theTarget, AtomicInteger theInteger)THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODEstatic voidwaitForSize(int theTarget, Callable<Integer> theSource)THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODE
-
-
-
Constructor Detail
-
TestUtil
public TestUtil()
-
-
Method Detail
-
setShouldRandomizeTimezones
public static void setShouldRandomizeTimezones(boolean theShouldRandomizeTimezones)
-
clearAllStaticFieldsForUnitTest
public static void clearAllStaticFieldsForUnitTest()
THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODEWhen we run the unit tests in cobertura, JUnit doesn't seem to clean up static fields which leads to tons of memory being used by the end and the JVM crashes in Travis. Manually clearing all of the static fields seems to solve this.
-
randomizeLocale
public static void randomizeLocale()
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
-
waitForSize
public static void waitForSize(int theTarget, AtomicInteger theInteger)
THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODEWait for an atomicinteger to hit a given site and fail if it never does
-
waitForSize
public static void waitForSize(int theTarget, Callable<Integer> theSource) throws Exception
THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODEWait for an atomicinteger to hit a given site and fail if it never does
- Throws:
Exception
-
stripReturns
public static String stripReturns(String theString)
THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODEStrip \r chars from a string to account for line ending platform differences
-
stripWhitespace
public static String stripWhitespace(String theString)
THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODEStrip \r chars from a string to account for line ending platform differences
-
-