Class TestUtil

    • Method Detail

      • clearAllStaticFieldsForUnitTest

        public static void clearAllStaticFieldsForUnitTest()
        THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODE

        When 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 CODE

        Wait 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 CODE

        Wait 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 CODE

        Strip \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 CODE

        Strip \r chars from a string to account for line ending platform differences