Tabnine Logo
de.taimos.restutils
Code IndexAdd Tabnine to your IDE (free)

How to use de.taimos.restutils

Best Java code snippets using de.taimos.restutils (Showing top 20 results out of 315)

origin: de.taimos/restutils

/**
 * returns if condition evaluates to true and throws {@link WebApplicationException}(422) if it evaluates to false
 * 
 * @param condition the condition to assert
 * @throws WebApplicationException with status code 422 (Unprocessable Entity) if condition is <i>false</i>
 */
public static void assertTrue(final boolean condition) {
  RESTAssert.assertTrue(condition, RESTAssert.DEFAULT_STATUS_CODE);
}

origin: de.taimos/restutils

/**
 * fails every time; same as assertTrue(false)
 * 
 * @throws WebApplicationException with status code 422 (Unprocessable Entity)
 */
public static void fail() {
  RESTAssert.fail(RESTAssert.DEFAULT_STATUS_CODE);
}

origin: de.taimos/restutils

/**
 * assert that string matches [+-]?[0-9]*
 * 
 * @param string the string to check
 * @param status the status code to throw
 * @throws WebApplicationException with given status code
 */
public static void assertInt(final String string, final StatusType status) {
  RESTAssert.assertNotEmpty(string);
  RESTAssert.assertPattern(string, "[+-]?[0-9]*", status);
}

origin: de.taimos/restutils

/**
 * assert that collection has one element
 * 
 * @param collection the collection to check
 * @param status the status code to throw
 * @throws WebApplicationException with given status code
 */
public static void assertSingleElement(final Collection<?> collection, final StatusType status) {
  RESTAssert.assertNotNull(collection, status);
  RESTAssert.assertTrue(collection.size() == 1, status);
}

origin: de.taimos/restutils

/**
 * 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);
}

origin: de.taimos/restutils

/**
 * assert that object is not null
 * 
 * @param object the object to check
 * @throws WebApplicationException with status code 422 (Unprocessable Entity)
 */
public static void assertNotNull(final Object object) {
  RESTAssert.assertNotNull(object, RESTAssert.DEFAULT_STATUS_CODE);
}

origin: de.taimos/restutils

/**
 * assert that string is not null nor empty
 * 
 * @param string the string to check
 * @throws WebApplicationException with status code 422 (Unprocessable Entity)
 */
public static void assertNotEmpty(final String string) {
  RESTAssert.assertNotEmpty(string, RESTAssert.DEFAULT_STATUS_CODE);
}

origin: de.taimos/restutils

/**
 * 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);
}

origin: de.taimos/restutils

/**
 * assert that string matches [+-]?[0-9]*
 * 
 * @param string the string to check
 * @throws WebApplicationException with status code 422 (Unprocessable Entity)
 */
public static void assertInt(final String string) {
  RESTAssert.assertInt(string, RESTAssert.DEFAULT_STATUS_CODE);
}

origin: de.taimos/restutils

/**
 * assert that collection has one element
 * 
 * @param collection the collection to check
 * @throws WebApplicationException with status code 422 (Unprocessable Entity)
 */
public static void assertSingleElement(final Collection<?> collection) {
  RESTAssert.assertSingleElement(collection, RESTAssert.DEFAULT_STATUS_CODE);
}

origin: de.taimos/restutils

/**
 * assert that objects are equal.<br>
 * This means they are both <i>null</i> or <code>one.equals(two)</code> returns <i>true</i>
 * 
 * @param one the first object
 * @param two the second object
 * @throws WebApplicationException with status code 422 (Unprocessable Entity)
 */
public static void assertEquals(final Object one, final Object two) {
  RESTAssert.assertEquals(one, two, RESTAssert.DEFAULT_STATUS_CODE);
}

origin: de.taimos/restutils

/**
 * assert that string matches the given pattern
 * 
 * @param string the string to check
 * @param pattern the pattern to check
 * @throws WebApplicationException with status code 422 (Unprocessable Entity)
 */
public static void assertPattern(String string, String pattern) {
  RESTAssert.assertPattern(string, pattern, RESTAssert.DEFAULT_STATUS_CODE);
}

origin: de.taimos/restutils

/**
 * assert that string matches the given pattern
 * 
 * @param string the string to check
 * @param status the status code to throw
 * @throws WebApplicationException with given status code
 */
public static void assertPattern(String string, String pattern, final StatusType status) {
  RESTAssert.assertNotNull(string);
  RESTAssert.assertNotNull(pattern);
  RESTAssert.assertTrue(string.matches(pattern), status);
}

origin: de.taimos/restutils

/**
 * 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);
}

origin: de.taimos/spring-cxf-daemon

public static final UUID requestId() {
  final InvocationInstance ii = SecurityContextUtil.getContext().getContent(InvocationInstance.class);
  RESTAssert.assertNotNull(ii, Status.INTERNAL_SERVER_ERROR);
  return ii.getMessageId();
}

origin: de.taimos/restutils

/**
 * assert that collection is not empty
 * 
 * @param collection the collection to check
 * @throws WebApplicationException with status code 422 (Unprocessable Entity)
 */
public static void assertNotEmpty(final Collection<?> collection) {
  RESTAssert.assertNotEmpty(collection, RESTAssert.DEFAULT_STATUS_CODE);
}

origin: de.taimos/restutils

/**
 * assert that object is not null
 * 
 * @param object the object to check
 * @param status the status code to throw
 * @throws WebApplicationException with given status code
 */
public static void assertNotNull(final Object object, final StatusType status) {
  RESTAssert.assertTrue(object != null, status);
}

origin: de.taimos/restutils

/**
 * returns if condition evaluates to false and throws {@link WebApplicationException} if it evaluates to true
 * 
 * @param condition the condition to assert
 * @param status the status code to throw
 * @throws WebApplicationException with given status code if condition is <i>true</i>
 */
public static void assertFalse(final boolean condition, final StatusType status) {
  if (condition) {
    RESTAssert.fail(status);
  }
}

origin: de.taimos/restutils

/**
 * 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);
}

origin: de.taimos/restutils

/**
 * assert that objects are equal.<br>
 * This means they are both <i>null</i> or <code>one.equals(two)</code> returns <i>true</i>
 * 
 * @param one the first object
 * @param two the second object
 * @param status the status code to throw
 * @throws WebApplicationException with given status code
 */
@SuppressWarnings("null")
public static void assertEquals(final Object one, final Object two, final StatusType status) {
  if ((one == null) && (two == null)) {
    return;
  }
  RESTAssert.assertNotNull(one, status);
  RESTAssert.assertTrue(one.equals(two), status);
}

de.taimos.restutils

Most used classes

  • RESTAssert
    Use this class to assert preconditions in REST Handler assert methods throw WebApplicationException
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now