info.magnolia.module.rssaggregator.util
Class Assert

java.lang.Object
  extended by info.magnolia.module.rssaggregator.util.Assert

public final class Assert
extends Object

Assertion utility class that assists in validating arguments. Useful for identifying programmer errors early and clearly at runtime.

Author:
Rob van der Linden Vooren

Method Summary
static void isTrue(boolean expression, String message)
          Assert a boolean expression, throwing IllegalArgumentException if the test result is false.
static void notBlank(String s, String message)
          Assert that the given String has valid text content; that is, it must not be null and must contain at least one non-whitespace character.
static void notNull(Object o, String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

notBlank

public static void notBlank(String s,
                            String message)
Assert that the given String has valid text content; that is, it must not be null and must contain at least one non-whitespace character.
 Assert.hasText(name, "'name' must not be empty");
 

Parameters:
s - the String to check
message - the exception message to use if the assertion fails
See Also:
StringUtils.isEmpty(String)

notNull

public static void notNull(Object o,
                           String message)

isTrue

public static void isTrue(boolean expression,
                          String message)
Assert a boolean expression, throwing IllegalArgumentException if the test result is false.

Parameters:
expression - a boolean expression
message - the exception message to use if the assertion fails
Throws:
IllegalArgumentException - if expression is false


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.