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

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

Introduction

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

Prototype

public static final int size(Map<?, ?> map) 

Source Link

Usage

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

/**
 * Makes sure that {@link RawPropertiesRepo#entityExists(String)}
 * and/or {@link RawPropertiesRepo#getProperties(String)} return
 * correct result for non-existing entities
 *//*from w ww  .ja v a2 s  .  c  o  m*/
@Test
public void testGetNonExistingEntityProperties() {
    for (int index = 0; index < Byte.SIZE; index++) {
        String id = String.valueOf(Math.random());
        assertFalse("Unexpected existence for ID=" + id, repo.entityExists(id));

        Map<?, ?> props = repo.getProperties(id);
        if (ExtendedMapUtils.size(props) > 0) {
            fail("Unexpected proeprties for ID=" + id + ": " + props);
        }
    }
}

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

/**
 * Makes sure that {@link RawPropertiesRepo#removeProperties(String)}
 * returns no properties for a non-existing entity
 *///from   w ww .  j av  a2s  .  com
@Test
public void testRemoveNonExistingEntityProperties() {
    final String ID = getClass().getSimpleName() + "#testRemoveNonExistingEntityProperties";
    assertSimplePropertiesUpdate(ID, createEntityProperties(ID));
    repo.removeProperties(ID);

    for (int index = 0; index < Byte.SIZE; index++) {
        Map<?, ?> actual = repo.removeProperties(ID);
        if (ExtendedMapUtils.size(actual) > 0) {
            fail("Unexpected properties values at index=" + index + ": " + actual);
        }
    }
}