Example usage for org.apache.commons.collections15 ExtendedMapUtils compareMaps

List of usage examples for org.apache.commons.collections15 ExtendedMapUtils compareMaps

Introduction

In this page you can find the example usage for org.apache.commons.collections15 ExtendedMapUtils compareMaps.

Prototype

public static final boolean compareMaps(Map<?, ?> m1, Map<?, ?> m2) 

Source Link

Usage

From source file:org.springframework.jdbc.repo.impl.jdbc.RawPropertiesRepoImplTest.java

/**
 * Makes sure that {@link RawPropertiesRepo#entityExists(String)}
 * behaves as expected on entity properties removal and also that
 * {@link RawPropertiesRepo#removeProperties(String)} returns the
 * original properties for the removed entity
 *//*from w  w  w .jav a 2 s .com*/
@Test
public void testRemoveExistingEntityProperties() {
    final String ID = getClass().getSimpleName() + "#testRemoveEntityProperties";
    Map<String, Serializable> expected = assertSimplePropertiesUpdate(ID, createEntityProperties(ID));
    assertTrue("Candidate entity not found", repo.entityExists(ID));

    Map<String, Serializable> actual = repo.removeProperties(ID);
    assertFalse("Removed entity still reported as existing", repo.entityExists(ID));
    if (!ExtendedMapUtils.compareMaps(expected, actual)) {
        fail("Mismatched properties: expected=" + expected + ", actual=" + actual);
    }
}

From source file:org.springframework.jdbc.repo.impl.jdbc.RawPropertiesRepoImplTest.java

private Map<String, Serializable> assertSimplePropertiesUpdate(String id, Map<String, Serializable> expected) {
    repo.setProperties(id, expected);/*from   www . j  a v a  2 s . c o  m*/

    Map<String, Serializable> actual = repo.getProperties(id);
    if (!ExtendedMapUtils.compareMaps(expected, actual)) {
        fail("Mismatched properties: expected=" + expected + ", actual=" + actual);
    }

    return actual;
}