Class TestUtils

java.lang.Object
com.vaadin.flow.testutil.TestUtils

public final class TestUtils extends Object
Shared code to use in the unit tests.
Since:
1.0.
Author:
Vaadin Ltd
  • Method Details

    • getTestJar

      public static File getTestJar()
      An easy way to get a test jar. Fails if the file was not found.
      Returns:
      test jar file
    • getTestJar

      public static File getTestJar(String jarName)
      Gets a test jar file by its resource name using getTestResource(String).
      Parameters:
      jarName - the resource name of a jar file
      Returns:
      corresponding test jar file
    • getTestFolder

      public static File getTestFolder(String name)
      Gets a test folder by its resource name using getTestResource(String).
      Parameters:
      name - the resource name of the folder
      Returns:
      corresponding folder
    • getTestResource

      public static URL getTestResource(String resourceName)
      Gets a test resouce by its name using using ClassLoader.getResource(String). Fails if the file was not found (null).
      Parameters:
      resourceName - the resource name
      Returns:
      corresponding resource url
    • listFilesRecursively

      public static List<String> listFilesRecursively(File directory)
      Lists all file (not directories) paths in directory specified. Fails if directory specified does not exist or is not a directory.
      Parameters:
      directory - directory to list files in
      Returns:
      list of paths, relative to the directory specified