public final class RESTAssert extends Object
WebApplicationException on failure| Modifier and Type | Field and Description |
|---|---|
static String |
PATTERN_DATE
Pattern for date 'yyyy-MM-dd'
|
static String |
PATTERN_DATETIME
Pattern for datetime 'yyyy-MM-dd HH:mm:ss'
|
static String |
PATTERN_ISO
Pattern for ISO date
|
static String |
PATTERN_TIME
Pattern for time 'HH:mm:ss'
|
| Modifier and Type | Method and Description |
|---|---|
static void |
assertEquals(Object one,
Object two)
assert that objects are equal.
This means they are both null or one.equals(two) returns true |
static void |
assertEquals(Object one,
Object two,
javax.ws.rs.core.Response.Status status)
assert that objects are equal.
This means they are both null or one.equals(two) returns true |
static void |
assertFalse(boolean condition)
returns if condition evaluates to false and throws
WebApplicationException(412) if it evaluates to true |
static void |
assertFalse(boolean condition,
javax.ws.rs.core.Response.Status status)
returns if condition evaluates to false and throws
WebApplicationException if it evaluates to true |
static void |
assertInt(String string)
assert that string matches [+-]?[0-9]*
|
static void |
assertInt(String string,
javax.ws.rs.core.Response.Status status)
assert that string matches [+-]?[0-9]*
|
static void |
assertNotEmpty(Collection<?> collection)
assert that collection is not empty
|
static void |
assertNotEmpty(Collection<?> collection,
javax.ws.rs.core.Response.Status status)
assert that collection is not empty
|
static void |
assertNotEmpty(String string)
assert that string is not null nor empty
|
static void |
assertNotEmpty(String string,
javax.ws.rs.core.Response.Status status)
assert that string is not null nor empty
|
static void |
assertNotNull(Object object)
assert that object is not null
|
static void |
assertNotNull(Object object,
javax.ws.rs.core.Response.Status status)
assert that object is not null
|
static void |
assertPattern(String string,
String pattern)
assert that string matches the given pattern
|
static void |
assertPattern(String string,
String pattern,
javax.ws.rs.core.Response.Status status)
assert that string matches the given pattern
|
static void |
assertSingleElement(Collection<?> collection)
assert that collection has one element
|
static void |
assertSingleElement(Collection<?> collection,
javax.ws.rs.core.Response.Status status)
assert that collection has one element
|
static void |
assertTrue(boolean condition)
returns if condition evaluates to true and throws
WebApplicationException(412) if it evaluates to false |
static void |
assertTrue(boolean condition,
javax.ws.rs.core.Response.Status status)
returns if condition evaluates to true and throws
WebApplicationException if it evaluates to false |
static void |
changeFailStatus(javax.ws.rs.core.Response.Status _status) |
static void |
fail()
fails every time; same as assertTrue(false)
|
static void |
fail(javax.ws.rs.core.Response.Status status)
fails every time; same as assertTrue(false)
|
public static final String PATTERN_DATE
public static final String PATTERN_TIME
public static final String PATTERN_DATETIME
public static final String PATTERN_ISO
public static void changeFailStatus(javax.ws.rs.core.Response.Status _status)
_status - the new default status codepublic static void assertTrue(boolean condition)
WebApplicationException(412) if it evaluates to falsecondition - the condition to assertjavax.ws.rs.WebApplicationException - with status code 412 (Precondition failed) if condition is falsepublic static void assertTrue(boolean condition,
javax.ws.rs.core.Response.Status status)
WebApplicationException if it evaluates to falsecondition - the condition to assertstatus - the status code to throwjavax.ws.rs.WebApplicationException - with given status code if condition is falsepublic static void assertFalse(boolean condition)
WebApplicationException(412) if it evaluates to truecondition - the condition to assertjavax.ws.rs.WebApplicationException - with status code 412 (Precondition failed) if condition is truepublic static void assertFalse(boolean condition,
javax.ws.rs.core.Response.Status status)
WebApplicationException if it evaluates to truecondition - the condition to assertstatus - the status code to throwjavax.ws.rs.WebApplicationException - with given status code if condition is truepublic static void fail(javax.ws.rs.core.Response.Status status)
status - the status to fail withjavax.ws.rs.WebApplicationException - with given status codepublic static void fail()
javax.ws.rs.WebApplicationException - with given status codepublic static void assertNotNull(Object object)
object - the object to checkjavax.ws.rs.WebApplicationException - with status code 412 (Precondition failed)public static void assertNotNull(Object object, javax.ws.rs.core.Response.Status status)
object - the object to checkstatus - the status code to throwjavax.ws.rs.WebApplicationException - with given status codepublic static void assertNotEmpty(String string)
string - the string to checkjavax.ws.rs.WebApplicationException - with status code 412 (Precondition failed)public static void assertNotEmpty(String string, javax.ws.rs.core.Response.Status status)
string - the string to checkstatus - the status code to throwjavax.ws.rs.WebApplicationException - with given status codepublic static void assertNotEmpty(Collection<?> collection)
collection - the collection to checkjavax.ws.rs.WebApplicationException - with status code 412 (Precondition failed)public static void assertNotEmpty(Collection<?> collection, javax.ws.rs.core.Response.Status status)
collection - the collection to checkstatus - the status code to throwjavax.ws.rs.WebApplicationException - with given status codepublic static void assertSingleElement(Collection<?> collection)
collection - the collection to checkjavax.ws.rs.WebApplicationException - with status code 412 (Precondition failed)public static void assertSingleElement(Collection<?> collection, javax.ws.rs.core.Response.Status status)
collection - the collection to checkstatus - the status code to throwjavax.ws.rs.WebApplicationException - with given status codepublic static void assertEquals(Object one, Object two)
one.equals(two) returns trueone - the first objecttwo - the second objectjavax.ws.rs.WebApplicationException - with status code 412 (Precondition failed)public static void assertEquals(Object one, Object two, javax.ws.rs.core.Response.Status status)
one.equals(two) returns trueone - the first objecttwo - the second objectstatus - the status code to throwjavax.ws.rs.WebApplicationException - with given status codepublic static void assertInt(String string)
string - the string to checkjavax.ws.rs.WebApplicationException - with status code 412 (Precondition failed)public static void assertInt(String string, javax.ws.rs.core.Response.Status status)
string - the string to checkstatus - the status code to throwjavax.ws.rs.WebApplicationException - with given status codepublic static void assertPattern(String string, String pattern)
string - the string to checkpattern - the pattern to checkjavax.ws.rs.WebApplicationException - with given status codepublic static void assertPattern(String string, String pattern, javax.ws.rs.core.Response.Status status)
string - the string to checkstatus - the status code to throwjavax.ws.rs.WebApplicationException - with given status codeCopyright © 2011-2014 Taimos GmbH. All Rights Reserved.