/** * Returns true if this index contains the given id. * * @param id the id of a given resource. * @return true if this index contains the given id. * @throws DataAccessLayerException in case of data access failure. */ public boolean contains(final byte[] id) throws DataAccessLayerException { return _byId.containsKey(id); }
/** * Returns true if a given element is found within this set. * * @param o the element. * @return true if a given element is found within this set, false otherwise. * @throws DataAccessLayerException in case of data access failure. */ public boolean contains(final E o) throws DataAccessLayerException { return o == null ? false : _map.containsKey(o); }
/** * Returns true if a given element is found within this set. * * @param o the element. * @return true if a given element is found within this set, false otherwise. * @throws DataAccessLayerException in case of data access failure. */ public boolean contains(final E o) throws DataAccessLayerException { return o == null ? false : _map.containsKey(o); }
/** * Returns true if this index contains the given id. * * @param id the id of a given resource. * @return true if this index contains the given id. * @throws DataAccessLayerException in case of data access failure. */ public boolean contains(final byte[] id) throws DataAccessLayerException { return _byId.containsKey(id); }
@Test public void containsKeyTest() throws DataAccessLayerException { for (String key : TESTDATA1.keySet()) { assertTrue(map.containsKey(key)); } for (String key : TESTDATA4.keySet()) { assertTrue(!map.containsKey(key)); } }
/** * contains(id) method should use the "ById" index. * * @throws Exception never otherwise the test fails. */ @Test public void contains() throws Exception { final byte[] id = { 1, 2, 3, 4 }; _cut.contains(id); verify(_byId).containsKey(id); }
@Test public void insertAllTest() throws DataAccessLayerException { map.clear(); assertTrue(map.isEmpty()); map.putAll(TESTDATA1); for (String key : TESTDATA1.keySet()) { assertTrue(map.containsKey(key)); } for (String key : TESTDATA1.keySet()) { assertEquals(TESTDATA1.get(key), map.get(key)); } }