Package com.vaadin.flow.testutil
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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FilegetTestFolder(String name)Gets a test folder by its resource name usinggetTestResource(String).static FilegetTestJar()An easy way to get a test jar.static FilegetTestJar(String jarName)Gets a test jar file by its resource name usinggetTestResource(String).static URLgetTestResource(String resourceName)Gets a test resouce by its name using usingClassLoader.getResource(String).static List<String>listFilesRecursively(File directory)Lists all file (not directories) paths in directory specified.
-
-
-
Method Detail
-
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 usinggetTestResource(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 usinggetTestResource(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 usingClassLoader.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
-
-