LocalDataSet implements Region, QueryExecutor { @Override public boolean isEmpty() { return size() == 0; } LocalDataSet(PartitionedRegion pr, int[] buckets);  LocalDataSet(PartitionedRegion pr, Set<Integer> buckets); @Override Set<Region.Entry> entrySet(boolean recursive); @Override Set<Region.Entry> entrySet(); @Override Collection values(); Set keys(); @Override Set keySet(); Collection localValues(); Set<Region.Entry> localEntrySet(); Set<Region.Entry> localKeys(); InternalRegionFunctionContext getFunctionContext(); void setFunctionContext(InternalRegionFunctionContext fContext); @Override SelectResults query(String queryPredicate); @Override Object selectValue(String queryPredicate); @Override Object executeQuery(DefaultQuery query,
      final ExecutionContext executionContext,
      Object[] parameters, Set buckets); PartitionedRegion getProxy(); Set<Integer> getBucketSet(); @Override void becomeLockGrantor(); @Override void clear(); @Override void close(); @Override boolean containsKeyOnServer(Object key); @Override boolean containsValue(Object value); @Override void create(Object key, Object value); @Override void create(Object key, Object value, Object callbackArgument); @Override Region createSubregion(String subregionName, RegionAttributes regionAttributes); @Override Object destroy(Object key); @Override Object destroy(Object key, Object callbackArgument); @Override void destroyRegion(); @Override void destroyRegion(Object callbackArgument); @Override boolean existsValue(String queryPredicate); @Override void forceRolling(); @Override InternalCache getCache(); @Override String getFullPath(); @Override List getInterestList(); @Override List getInterestListRegex(); @Override String getName(); @Override Region getParentRegion(); @Override Lock getRegionDistributedLock(); @Override CacheStatistics getStatistics(); @Override Region getSubregion(String path); @Override RegionAttributes getAttributes(); @Override AttributesMutator getAttributesMutator(); @Override Lock getDistributedLock(Object key); @Override void invalidate(Object key); @Override void invalidate(Object key, Object callbackArgument); @Override void invalidateRegion(); @Override void invalidateRegion(Object callbackArgument); @Override boolean isDestroyed(); @Override boolean isEmpty(); @Override Object getUserAttribute(); int[] getDiskDirSizes(); @Override Set subregions(boolean recursive); @Override void unregisterInterest(Object key); @Override void unregisterInterestRegex(String regex); @Override void writeToDisk(); @Override void setUserAttribute(Object value); @Override Object remove(Object key); @Override void registerInterest(Object key); @Override void registerInterest(Object key, boolean isDurable); @Override void registerInterest(Object key, InterestResultPolicy policy); @Override void registerInterest(Object key, InterestResultPolicy policy, boolean isDurable); @Override void registerInterestRegex(String regex); @Override void registerInterestRegex(String regex, boolean isDurable); @Override void registerInterestRegex(String regex, InterestResultPolicy policy); @Override void registerInterestRegex(String regex, InterestResultPolicy policy, boolean isDurable); @Override Set keySetOnServer(); @Override int sizeOnServer(); @Override boolean isEmptyOnServer(); @Override void loadSnapshot(InputStream inputStream); @Override Map getAll(Collection keys); @Override Map getAll(Collection keys, Object callback); @Override void localClear(); @Override void localDestroyRegion(); @Override void localDestroyRegion(Object callbackArgument); @Override void localInvalidateRegion(); @Override void localInvalidateRegion(Object callbackArgument); @Override void localDestroy(Object key); @Override void localDestroy(Object key, Object callbackArgument); @Override void localInvalidate(Object key); @Override void localInvalidate(Object key, Object callbackArgument); @Override Object put(Object key, Object value); @Override Object put(Object key, Object value, Object callbackArgument); @Override void putAll(Map map); @Override void putAll(Map map, Object callbackArg); @Override boolean containsKey(Object key); @Override boolean containsValueForKey(Object key); @Override Entry getEntry(Object key); @Override int size(); @Override Object get(Object key); @Override Object get(Object key, Object aCallbackArgument); String toString(); @Override void saveSnapshot(OutputStream outputStream); @Override void registerInterest(Object key, boolean isDurable, boolean receiveValues); @Override void registerInterest(Object key, InterestResultPolicy policy, boolean isDurable,
      boolean receiveValues); @Override void registerInterestRegex(String regex, boolean isDurable, boolean receiveValues); @Override void registerInterestRegex(String regex, InterestResultPolicy policy, boolean isDurable,
      boolean receiveValues); @Override Object putIfAbsent(Object key, Object value); @Override boolean remove(Object key, Object value); @Override Object replace(Object key, Object value); @Override boolean replace(Object key, Object oldValue, Object newValue); @Override RegionService getRegionService(); @Override RegionSnapshotService<?, ?> getSnapshotService(); @Override void removeAll(Collection keys); @Override void removeAll(Collection keys, Object aCallbackArgument);  }
@Test public void verifyThatIsEmptyIsTrueWhenEntryCountReturnsZero() { PartitionedRegion pr = mock(PartitionedRegion.class); when(pr.isEmpty()).thenReturn(false); when(pr.entryCount(any())).thenReturn(0); LocalDataSet lds = new LocalDataSet(pr, Collections.emptySet()); assertTrue(lds.isEmpty()); }
@Test public void verifyThatIsEmptyIsFalseWhenEntryCountReturnsNonZero() { PartitionedRegion pr = mock(PartitionedRegion.class); when(pr.isEmpty()).thenReturn(true); when(pr.entryCount(any())).thenReturn(1); LocalDataSet lds = new LocalDataSet(pr, Collections.emptySet()); assertFalse(lds.isEmpty()); }