Package de.xima.fc.testhelper
Class TestHelper
- java.lang.Object
-
- de.xima.fc.testhelper.TestHelper
-
public final class TestHelper extends Object
-
-
Constructor Summary
Constructors Constructor Description TestHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertContains(Iterable<?> expected, Object actual)
static void
assertContains(String expectedContent, String value)
static void
assertContainsEntries(Map<Object,Object> expected, Object actual)
static void
assertContainsValuesAtKeys(Set<?> expectedKeys, Set<?> expectedValues, Object actual)
static void
assertEmpty(String actual)
static void
assertEmpty(List<?> actual)
static void
assertEndsWith(String expectedSuffix, String actual)
static <T> T
assertIsInstance(Class<T> clazz, Object item)
static <T extends Throwable>
TassertIsOrHasCause(Throwable actual, Class<T> expectedType)
static void
assertLinesEqual(String expected, String actual)
static void
assertSameItems(Object expected, Object actual)
static void
assertStartsWith(String expectedPrefix, String actual)
static File
createTmpDir()
static File
createTmpFile(byte[] content, String fileName, String extension)
Creates a file in the temp folder with the specified contentstatic File
createTmpFile(String content, String fileName, String extension)
Creates a file in the temp folder with the specified contentstatic File
createTmpTextFile(String content)
Creates a file in the temp folder with the specified contentstatic <T> List<T>
list(T... items)
static <K,V>
Map<K,V>map(Object... items)
static <T> Set<T>
set(T... items)
static String
str(byte[] bytes)
static <K,V>
Map<K,V>submap(Map<K,V> map, Iterable<?> keys)
static <K,V>
Map<K,V>submap(Map<K,V> map, K... keys)
-
-
-
Method Detail
-
assertContainsValuesAtKeys
public static void assertContainsValuesAtKeys(Set<?> expectedKeys, Set<?> expectedValues, Object actual)
-
assertEmpty
public static void assertEmpty(List<?> actual)
-
assertContainsEntries
public static void assertContainsEntries(Map<Object,Object> expected, Object actual)
-
assertEmpty
public static void assertEmpty(String actual)
-
createTmpDir
public static File createTmpDir() throws IOException
- Throws:
IOException
-
createTmpFile
public static File createTmpFile(String content, String fileName, String extension) throws IOException
Creates a file in the temp folder with the specified content- Parameters:
content
- the file contentfileName
- Name of the tmp fileextension
- Extension of the tmp file.- Returns:
- the
File
instance - Throws:
IOException
- When the text file could not be created.
-
createTmpFile
public static File createTmpFile(byte[] content, String fileName, String extension) throws IOException
Creates a file in the temp folder with the specified content- Parameters:
content
- the file contentfileName
- Name of the tmp fileextension
- Extension of the tmp file.- Returns:
- the
File
instance - Throws:
IOException
- When the text file could not be created.
-
createTmpTextFile
public static File createTmpTextFile(String content) throws IOException
Creates a file in the temp folder with the specified content- Parameters:
content
- the file content- Returns:
- the
File
instance - Throws:
IOException
- When the text file could not be created.
-
assertIsOrHasCause
public static <T extends Throwable> T assertIsOrHasCause(Throwable actual, Class<T> expectedType)
-
list
public static <T> List<T> list(T... items)
-
set
public static <T> Set<T> set(T... items)
-
str
public static String str(byte[] bytes)
-
-