org.fest.assertions.internal
Class Maps

java.lang.Object
  extended by org.fest.assertions.internal.Maps

public class Maps
extends Object

Reusable assertions for Maps.

Author:
Alex Ruiz

Method Summary
 void assertContains(AssertionInfo info, Map<?,?> actual, MapEntry[] entries)
          Asserts that the given Map contains the given entries, in any order.
 void assertDoesNotContain(AssertionInfo info, Map<?,?> actual, MapEntry[] entries)
          Asserts that the given Map does not contain the given entries.
 void assertEmpty(AssertionInfo info, Map<?,?> actual)
          Asserts that the given Map is empty.
 void assertHasSize(AssertionInfo info, Map<?,?> actual, int expectedSize)
          Asserts that the number of entries in the given Map is equal to the expected one.
 void assertNotEmpty(AssertionInfo info, Map<?,?> actual)
          Asserts that the given Map is not empty.
 void assertNullOrEmpty(AssertionInfo info, Map<?,?> actual)
          Asserts that the given Map is null or empty.
static Maps instance()
          Returns the singleton instance of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static Maps instance()
Returns the singleton instance of this class.

Returns:
the singleton instance of this class.

assertNullOrEmpty

public void assertNullOrEmpty(AssertionInfo info,
                              Map<?,?> actual)
Asserts that the given Map is null or empty.

Parameters:
info - contains information about the assertion.
actual - the given map.
Throws:
AssertionError - if the given Map is not null *and* contains one or more entries.

assertEmpty

public void assertEmpty(AssertionInfo info,
                        Map<?,?> actual)
Asserts that the given Map is empty.

Parameters:
info - contains information about the assertion.
actual - the given Map.
Throws:
AssertionError - if the given Map is null.
AssertionError - if the given Map is not empty.

assertNotEmpty

public void assertNotEmpty(AssertionInfo info,
                           Map<?,?> actual)
Asserts that the given Map is not empty.

Parameters:
info - contains information about the assertion.
actual - the given Map.
Throws:
AssertionError - if the given Map is null.
AssertionError - if the given Map is empty.

assertHasSize

public void assertHasSize(AssertionInfo info,
                          Map<?,?> actual,
                          int expectedSize)
Asserts that the number of entries in the given Map is equal to the expected one.

Parameters:
info - contains information about the assertion.
actual - the given Map.
expectedSize - the expected size of actual.
Throws:
AssertionError - if the given Map is null.
AssertionError - if the number of entries in the given Map is different than the expected one.

assertContains

public void assertContains(AssertionInfo info,
                           Map<?,?> actual,
                           MapEntry[] entries)
Asserts that the given Map contains the given entries, in any order.

Parameters:
info - contains information about the assertion.
actual - the given Map.
entries - the entries that are expected to be in the given Map.
Throws:
NullPointerException - if the array of entries is null.
IllegalArgumentException - if the array of entries is empty.
NullPointerException - if any of the entries in the given array is null.
AssertionError - if the given Map is null.
AssertionError - if the given Map does not contain the given entries.

assertDoesNotContain

public void assertDoesNotContain(AssertionInfo info,
                                 Map<?,?> actual,
                                 MapEntry[] entries)
Asserts that the given Map does not contain the given entries.

Parameters:
info - contains information about the assertion.
actual - the given Map.
entries - the entries that are expected to be in the given Map.
Throws:
NullPointerException - if the array of entries is null.
IllegalArgumentException - if the array of entries is empty.
NullPointerException - if any of the entries in the given array is null.
AssertionError - if the given Map is null.
AssertionError - if the given Map contains any of the given entries.


Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.