All Downloads are FREE. Search and download functionalities are using the official Maven repository.

public.javadoc.org.spincast.testing.core.utils.SpincastTestingUtils.html Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version






SpincastTestingUtils (org.spincast:spincast-framework 1.0.0 API)












org.spincast.testing.core.utils

Class SpincastTestingUtils



  • public class SpincastTestingUtils
    extends Object
    Spincast testing utilities.
    • Constructor Detail

      • SpincastTestingUtils

        public SpincastTestingUtils()
    • Method Detail

      • getThisClassFileInputStream

        protected static InputStream getThisClassFileInputStream()
      • generateTempClassFile

        public static File generateTempClassFile(File writableDir)
      • findFreePort

        public static int findFreePort()
        Finds a free port.
      • isPortAvailable

        public static boolean isPortAvailable(String host,
                                              int port)
        Is the specified port available? Note that this will be true at the time the method run, but may be false a couple of milliseconds after...
      • waitForTrue

        public static boolean waitForTrue(TrueChecker trueChecker)
        Since Websockets are async, it's hard to wait for a specific period of time before validating if an event occured. This method checks frequently if the TrueChecker returns true and when it does, it returns too. Il also waits for a maximum of 5 seconds.
      • waitForTrue

        public static boolean waitForTrue(TrueChecker trueChecker,
                                          int maxMillisecToWait)
        Since Websockets are async, it's hard to wait for a specific period of time before validating if an event occured. This method checks frequently if the TrueChecker returns true and when it does, it returns too. Il also waits for the maximum number of milliseconds specified.
      • waitForTrueLoopInterval

        protected static int waitForTrueLoopInterval()
      • waitForSize

        public static boolean waitForSize(Collection<?> collection,
                                          int expected)
        This method checks frequently if the size of the specified collection has reached the expected size. If so, it returns. Always returns after 5 seconds.
      • waitForSize

        public static boolean waitForSize(Collection<?> collection,
                                          int expected,
                                          int maxMillisecToWait)
        This method checks frequently if the size of the specified collection has reached the expected size. If so, it returns.
      • waitForMaxSize

        public static boolean waitForMaxSize(Collection<?> collection,
                                             int maxSize)
        This method checks frequently if the size of the specified collection is under the speficied max size. If so, it returns. Always returns after 5 seconds.
      • waitForMaxSize

        public static boolean waitForMaxSize(Collection<?> collection,
                                             int maxSize,
                                             int maxMillisecToWait)
        This method checks frequently if the size of the specified collection is under the speficied max size. If so, it returns.
      • waitForNumber

        public static boolean waitForNumber(int[] oneIntArray,
                                            int expected)
        This method checks frequently if the number of the first element of the specified int[] has reached the expected value. If so, it returns. Always returns after 5 seconds.
      • waitForNumber

        public static boolean waitForNumber(int[] oneIntArray,
                                            int expected,
                                            int maxMillisecToWait)
        This method checks frequently if the number of the first element of the specified int[] has reached the expected value. If so, it returns.
      • getTestDateNoTime

        public static Date getTestDateNoTime()
        Get a test date without time.
      • logException

        public static void logException(String fileName,
                                        Exception ex,
                                        String info)
        This method can be called to log some information about an exception wihch is hard to debug. It will log it in a directory which won't be deleted when the tests are done.
      • getClasspathFileNotInJar

        public static File getClasspathFileNotInJar(String relativePath)
        Gets a File from a classpath path (only works when the application si not running from an executable .jar).

Copyright © 2019. All rights reserved.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy