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 javax.mail.internet.InternetAddress[]addr(String... addresses)static voidassertContains(Iterable<?> expected, Object actual)static voidassertContains(String expectedContent, String value)static voidassertContainsEntries(Map<Object,Object> expected, Object actual)static voidassertContainsValuesAtKeys(Set<?> expectedKeys, Set<?> expectedValues, Object actual)static voidassertEmpty(String actual)static voidassertEmpty(List<?> actual)static voidassertEndsWith(String expectedSuffix, String actual)static <T> TassertHasOneItem(Iterable<T> actual)static voidassertInRange(com.google.common.collect.Range<Double> expected, double actual)static voidassertInRange(com.google.common.collect.Range<Float> expected, float actual)static voidassertInRange(com.google.common.collect.Range<Integer> expected, int actual)static voidassertInRange(com.google.common.collect.Range<Long> expected, long actual)static <T> TassertIsInstance(Class<T> clazz, Object item)static <T extends Throwable>
TassertIsOrHasCause(Throwable actual, Class<T> expectedType)static voidassertLinesEqual(String expected, String actual)static voidassertSameItems(Object expected, Object actual)static voidassertStartsWith(String expectedPrefix, String actual)static voidassertStreamEquals(byte[] expected, InputStream actual)static voidassertStreamEquals(InputStream expected, InputStream actual)static voidassertStreamEquals(Reader expected, Reader actual)static FilecreateTmpDir()static FilecreateTmpFile(byte[] content, String fileName, String extension)Creates a file in the temp folder with the specified contentstatic FilecreateTmpFile(String content, String fileName, String extension)Creates a file in the temp folder with the specified contentstatic FilecreateTmpTextFile(String content)Creates a file in the temp folder with the specified contentstatic <T> List<T>list(T... items)static javax.mail.Address[]mailBcc(org.subethamail.wiser.WiserMessage wiserMessage)static javax.mail.Address[]mailCc(org.subethamail.wiser.WiserMessage wiserMessage)static javax.mail.Address[]mailFrom(org.subethamail.wiser.WiserMessage wiserMessage)static javax.mail.Address[]mailReplyTo(org.subethamail.wiser.WiserMessage wiserMessage)static List<org.subethamail.wiser.WiserMessage>mailsSorted(org.subethamail.wiser.Wiser wiser)static StringmailSubject(org.subethamail.wiser.WiserMessage wiserMessage)static javax.mail.Address[]mailTo(org.subethamail.wiser.WiserMessage wiserMessage)static <K,V>
Map<K,V>map(Object... items)static intrandomFreePort()static <T> Set<T>set(T... items)static Stringstr(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
- 
addr
public static javax.mail.internet.InternetAddress[] addr(String... addresses)
 
- 
assertContainsEntries
public static void assertContainsEntries(Map<Object,Object> expected, Object actual)
 
- 
assertContainsValuesAtKeys
public static void assertContainsValuesAtKeys(Set<?> expectedKeys, Set<?> expectedValues, Object actual)
 
- 
assertHasOneItem
public static <T> T assertHasOneItem(Iterable<T> actual)
 
- 
assertEmpty
public static void assertEmpty(List<?> actual)
 
- 
assertEmpty
public static void assertEmpty(String actual)
 
- 
assertIsOrHasCause
public static <T extends Throwable> T assertIsOrHasCause(Throwable actual, Class<T> expectedType)
 
- 
assertInRange
public static void assertInRange(com.google.common.collect.Range<Double> expected, double actual)
 
- 
assertInRange
public static void assertInRange(com.google.common.collect.Range<Float> expected, float actual)
 
- 
assertInRange
public static void assertInRange(com.google.common.collect.Range<Integer> expected, int actual)
 
- 
assertInRange
public static void assertInRange(com.google.common.collect.Range<Long> expected, long actual)
 
- 
assertStreamEquals
public static void assertStreamEquals(byte[] expected, InputStream actual) 
- 
assertStreamEquals
public static void assertStreamEquals(InputStream expected, InputStream actual)
 
- 
createTmpDir
public static File createTmpDir() throws IOException
- Throws:
 IOException
 
- 
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 
Fileinstance - Throws:
 IOException- When the text file could not be created.
 
- 
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 
Fileinstance - 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 
Fileinstance - Throws:
 IOException- When the text file could not be created.
 
- 
list
@SafeVarargs public static <T> List<T> list(T... items)
 
- 
mailBcc
public static javax.mail.Address[] mailBcc(org.subethamail.wiser.WiserMessage wiserMessage) throws javax.mail.MessagingException- Throws:
 javax.mail.MessagingException
 
- 
mailCc
public static javax.mail.Address[] mailCc(org.subethamail.wiser.WiserMessage wiserMessage) throws javax.mail.MessagingException- Throws:
 javax.mail.MessagingException
 
- 
mailFrom
public static javax.mail.Address[] mailFrom(org.subethamail.wiser.WiserMessage wiserMessage) throws javax.mail.MessagingException- Throws:
 javax.mail.MessagingException
 
- 
mailReplyTo
public static javax.mail.Address[] mailReplyTo(org.subethamail.wiser.WiserMessage wiserMessage) throws javax.mail.MessagingException- Throws:
 javax.mail.MessagingException
 
- 
mailsSorted
public static List<org.subethamail.wiser.WiserMessage> mailsSorted(org.subethamail.wiser.Wiser wiser)
 
- 
mailSubject
public static String mailSubject(org.subethamail.wiser.WiserMessage wiserMessage) throws javax.mail.MessagingException
- Throws:
 javax.mail.MessagingException
 
- 
mailTo
public static javax.mail.Address[] mailTo(org.subethamail.wiser.WiserMessage wiserMessage) throws javax.mail.MessagingException- Throws:
 javax.mail.MessagingException
 
- 
randomFreePort
public static int randomFreePort()
 
- 
set
@SafeVarargs public static <T> Set<T> set(T... items)
 
- 
str
public static String str(byte[] bytes)
 
- 
submap
@SafeVarargs public static <K,V> Map<K,V> submap(Map<K,V> map, K... keys)
 
 - 
 
 -