|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectgroovy.org.codenarc.test.TestUtil
class TestUtil
Contains common static utility methods for tests
| Method Summary | |
|---|---|
static void
|
assertContainsAll(String text, def strings)
Assert that the text contains each of the specified strings |
static void
|
assertContainsAllInOrder(String text, def strings)
Assert that the text contains each of the specified strings, in order |
static void
|
assertEqualSets(Collection collection1, Collection collection2)
Assert that the two collections have equal Sets of elements. |
static List
|
captureLog4JMessages(groovy.lang.Closure closure)
|
static String
|
captureSystemOut(groovy.lang.Closure closure)
|
static boolean
|
containsAll(String text, def strings)
Return true if the text contains each of the specified strings |
static String
|
shouldFail(Class expectedExceptionClass, groovy.lang.Closure code)
Assert that the specified code throws an exception of the specified type. |
static String
|
shouldFail(groovy.lang.Closure code)
Assert that the specified code throws an exception (of any type). |
static String
|
shouldFailWithMessageContaining(Class expectedExceptionClass, String expectedText, groovy.lang.Closure code)
Assert that the specified code throws an exception whose message contains the specified text. |
static void
|
shouldFailWithMessageContaining(def text, groovy.lang.Closure closure)
Assert that the specified closure should throw an exception whose message contains text |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Method Detail |
|---|
static void assertContainsAll(String text, def strings)
text - - the text to searchstrings - - the Strings that must be present within text; toString() is invoked on each element
static void assertContainsAllInOrder(String text, def strings)
text - - the text to searchstrings - - the Strings that must be present within text, and appear
in the order specified; toString() is applied to each.
static void assertEqualSets(Collection collection1, Collection collection2)
static List captureLog4JMessages(groovy.lang.Closure closure)
static String captureSystemOut(groovy.lang.Closure closure)
static boolean containsAll(String text, def strings)
text - - the text to searchstrings - - the Strings to check for; toString() is invoked on each element
static String shouldFail(Class expectedExceptionClass, groovy.lang.Closure code)
expectedExceptionClass - - the Class of exception that is expected; may be nullcode - - the Closure containing the code to be executed, which is expected to throw an exception of the specified type
static String shouldFail(groovy.lang.Closure code)
code - - the Closure containing the code to be executed, which is expected to throw an exception of the specified type
static String shouldFailWithMessageContaining(Class expectedExceptionClass, String expectedText, groovy.lang.Closure code)
expectedExceptionClass - - the class of the Throwable that is expected to be thrownexpectedText - - the text expected within the exception messagecode - - the Closure containing the code to be executed, which is expected to throw an exception of the specified type
static void shouldFailWithMessageContaining(def text, groovy.lang.Closure closure)
text - - the text expected within the message; may be a single String or a List of Stringsclosure - - the Closure to execute
Groovy Documentation