@Test
 public void iterateOverMapEntries() {
   HazelcastClient hClient = getHazelcastClient();
   IMap<String, String> map = hClient.getMap("iterateOverMapEntries");
   map.put("1", "A");
   map.put("2", "B");
   map.put("3", "C");
   Set<Entry<String, String>> entrySet = map.entrySet();
   assertEquals(3, entrySet.size());
   Set<String> keySet = map.keySet();
   for (Entry<String, String> entry : entrySet) {
     assertTrue(keySet.contains(entry.getKey()));
     assertEquals(entry.getValue(), map.get(entry.getKey()));
   }
   Iterator<Entry<String, String>> it = entrySet.iterator();
   for (String key : keySet) {
     MapEntry mapEntry = map.getMapEntry(key);
     assertEquals(1, mapEntry.getHits());
   }
   while (it.hasNext()) {
     it.next();
     it.remove();
   }
   assertTrue(map.isEmpty());
 }
 @Test
 public void lockMap() throws InterruptedException {
   HazelcastClient hClient = getHazelcastClient();
   final IMap<String, String> map = hClient.getMap("lockMap");
   final CountDownLatch unlockLatch = new CountDownLatch(1);
   final CountDownLatch latch = new CountDownLatch(1);
   map.put("a", "b");
   map.lockMap(1, TimeUnit.SECONDS);
   assertTrue(map.tryPut("a", "c", 10, TimeUnit.MILLISECONDS));
   new Thread(
           new Runnable() {
             public void run() {
               assertFalse(map.lockMap(10, TimeUnit.MILLISECONDS));
               unlockLatch.countDown();
               assertTrue(map.lockMap(Long.MAX_VALUE, TimeUnit.SECONDS));
               latch.countDown();
               // map.unlockMap();
             }
           })
       .start();
   assertTrue(unlockLatch.await(10, TimeUnit.SECONDS));
   Thread.sleep(2000);
   map.unlockMap();
   assertEquals("c", map.getMapEntry("a").getValue());
   assertTrue(latch.await(10, TimeUnit.SECONDS));
 }
 @Test
 public void testGetNullMapEntry() {
   HazelcastClient hClient = getHazelcastClient();
   final IMap imap = hClient.getMap("testGetNullMapEntry");
   String key = "key";
   MapEntry mapEntry = imap.getMapEntry(key);
   assertNull(mapEntry);
 }
 @Test
 public void getMapEntry() {
   HazelcastClient hClient = getHazelcastClient();
   IMap map = hClient.getMap("getMapEntry");
   assertNull(map.put("a", "b"));
   map.get("a");
   map.get("a");
   MapEntry<String, String> entry = map.getMapEntry("a");
   assertEquals("a", entry.getKey());
   assertEquals("b", entry.getValue());
   assertEquals(2, entry.getHits());
   assertEquals("b", entry.getValue());
   assertEquals("b", entry.setValue("c"));
   assertEquals("c", map.get("a"));
   assertEquals("c", entry.getValue());
 }
 protected MapEntry refresh() {
   return map.getMapEntry(key);
 }
 @SuppressWarnings("unchecked")
 public MapEntryMBean(IMap map, Object key) {
   super(map.getMapEntry(key), null); // Is immutable...
   this.map = map;
   this.key = key;
 }