com.atlassian.jira.util
Class CollectionAssert

java.lang.Object
  extended by com.atlassian.jira.util.CollectionAssert

public class CollectionAssert
extends Object

Assertions for unit tests to use on collections. This was originally created to replace methods in the deprecated LegacyJiraMockTestCase.


Constructor Summary
CollectionAssert()
           
 
Method Summary
static
<T> void
assertContainsExactly(Collection<?> expected, Collection<?> actual)
          Asserts that the given collections have exactly the same items in an unordered manner.
static void checkSingleElementCollection(Collection collection, Object expected)
          Check that a collection has only one element, and that is the object provided
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionAssert

public CollectionAssert()
Method Detail

checkSingleElementCollection

public static void checkSingleElementCollection(Collection collection,
                                                Object expected)
Check that a collection has only one element, and that is the object provided


assertContainsExactly

public static <T> void assertContainsExactly(Collection<?> expected,
                                             Collection<?> actual)
Asserts that the given collections have exactly the same items in an unordered manner. Useful if the expected collections is expressed as a list (which is common) and you don't care about the order of the incoming collection, or that collection is incompatible with List.equals() - eg Set.

Parameters:
expected - Collection
actual - Collection


Copyright © 2002-2014 Atlassian. All Rights Reserved.