org.mockftpserver.core.util
Class Assert

java.lang.Object
  extended by org.mockftpserver.core.util.Assert

public final class Assert
extends Object

Provides static helper methods to make runtime assertions. Throws an AssertFailedException when the assertion fails. All methods are static.

Version:
$Revision: 8 $ - $Date: 2007-12-18 22:42:32 -0500 (Tue, 18 Dec 2007) $
Author:
Chris Mair

Method Summary
static void isFalse(boolean condition, String message)
          Verify that condition is false.
static void isNull(Object arg, String argName)
          Verify that arg is null.
static void isTrue(boolean condition, String message)
          Verify that condition is true.
static void notNull(Object arg, String argName)
          Verify that arg is not null.
static void notNullOrEmpty(Collection collection, String argName)
          Verify that the collection is not null or empty.
static void notNullOrEmpty(Map map, String argName)
          Verify that the Map is not null or empty.
static void notNullOrEmpty(Object[] array, String argName)
          Verify that the array is not null or empty.
static void notNullOrEmpty(String string, String argName)
          Verify that the String is not null or empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isNull

public static void isNull(Object arg,
                          String argName)
Verify that arg is null. Throw an AssertFailedException if it is not null.

Parameters:
arg - - the method parameter value
argName - - the name of the parameter; used in the exception message
Throws:
AssertFailedException - - if arg is not null

notNull

public static void notNull(Object arg,
                           String argName)
Verify that arg is not null. Throw an AssertFailedException if it is null.

Parameters:
arg - - the method parameter value
argName - - the name of the parameter; used in the exception message
Throws:
AssertFailedException - - if arg is null

isTrue

public static void isTrue(boolean condition,
                          String message)
Verify that condition is true. Throw an AssertFailedException if it is false.

Parameters:
condition - - the condition that should be true
Throws:
AssertFailedException - - if condition is false

isFalse

public static void isFalse(boolean condition,
                           String message)
Verify that condition is false. Throw an AssertFailedException if it is true.

Parameters:
condition - - the condition that should be false
Throws:
AssertFailedException - - if condition is true

notNullOrEmpty

public static void notNullOrEmpty(Collection collection,
                                  String argName)
Verify that the collection is not null or empty. Throw an AssertFailedException if it is null or empty.

Parameters:
collection - - the Collection
argName - - the name of the parameter; used in the exception message
Throws:
AssertFailedException - - if collection is null or empty

notNullOrEmpty

public static void notNullOrEmpty(Map map,
                                  String argName)
Verify that the Map is not null or empty. Throw an AssertFailedException if it is null or empty.

Parameters:
map - - the Map
argName - - the name of the parameter; used in the exception message
Throws:
AssertFailedException - - if map is null or empty

notNullOrEmpty

public static void notNullOrEmpty(Object[] array,
                                  String argName)
Verify that the array is not null or empty. Throw an AssertFailedException if it is null or empty.

Parameters:
array - - the array
argName - - the name of the parameter; used in the exception message
Throws:
AssertFailedException - - if array is null or empty

notNullOrEmpty

public static void notNullOrEmpty(String string,
                                  String argName)
Verify that the String is not null or empty. Throw an AssertFailedException if it is null or empty.

Parameters:
string - - the String
argName - - the name of the parameter; used in the exception message
Throws:
AssertFailedException - - if string is null or empty


Copyright © 2014. All rights reserved.