/** * returns if condition evaluates to true and throws {@link WebApplicationException} if it evaluates to false * * @param condition the condition to assert * @param status the status code to throw * @throws WebApplicationException with given status code if condition is <i>false</i> */ public static void assertTrue(final boolean condition, final StatusType status) { RESTAssert.assertFalse(!condition, status); }
/** * returns if condition evaluates to false and throws {@link WebApplicationException}(422) if it evaluates to true * * @param condition the condition to assert * @throws WebApplicationException with status code 422 (Unprocessable Entity) if condition is <i>true</i> */ public static void assertFalse(final boolean condition) { RESTAssert.assertFalse(condition, RESTAssert.DEFAULT_STATUS_CODE); }
/** * assert that collection is not empty * * @param collection the collection to check * @param status the status code to throw * @throws WebApplicationException with given status code */ public static void assertNotEmpty(final Collection<?> collection, final StatusType status) { RESTAssert.assertNotNull(collection, status); RESTAssert.assertFalse(collection.isEmpty(), status); }
/** * assert that string is not null nor empty * * @param string the string to check * @param status the status code to throw * @throws WebApplicationException with given status code */ public static void assertNotEmpty(final String string, final StatusType status) { RESTAssert.assertNotNull(string, status); RESTAssert.assertFalse(string.isEmpty(), status); }