Contains common static utility methods for tests
Type Params | Return Type | Name and description |
---|---|---|
|
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<org.apache.log4j.spi.LoggingEvent> |
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 |
Assert that the text contains each of the specified strings
text
- - the text to searchstrings
- - the Strings that must be present within text; toString() is invoked on each elementAssert that the text contains each of the specified strings, in order
text
- - the text to searchstrings
- - the Strings that must be present within text, and appear
in the order specified; toString() is applied to each.Assert that the two collections have equal Sets of elements. In other words, assert that the two collections are the same, ignoring ordering and duplicates.
Return true if the text contains each of the specified strings
text
- - the text to searchstrings
- - the Strings to check for; toString() is invoked on each elementAssert that the specified code throws an exception of the specified type. Return the thrown exception message.
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 typeAssert that the specified code throws an exception (of any type). Return the thrown exception message.
code
- - the Closure containing the code to be executed, which is expected to throw an exception of the specified typeAssert that the specified code throws an exception whose message contains the specified text.
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 typeAssert that the specified closure should throw an exception whose message contains text
text
- - the text expected within the message; may be a single String or a List of Stringsclosure
- - the Closure to execute