You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2017/05/22 18:29:58 UTC
[62/69] [abbrv] geode git commit: GEODE-2929: remove superfluous
final from methods
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
index 1700ccd..ea3f8d6 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
@@ -95,7 +95,7 @@ public class ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest
}
}
- private final void getAvailableCacheElseCreateCache() {
+ private void getAvailableCacheElseCreateCache() {
synchronized (ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.class) {
try {
Cache newCache = GemFireCacheImpl.getInstance();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
index cfd75ba..5a5c80d 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheSerializableRunnable.java
@@ -49,7 +49,7 @@ public abstract class CacheSerializableRunnable extends SerializableRunnable
* Invokes the {@link #run2} method and will wrap any {@link CacheException} thrown by
* <code>run2</code> in a {@link CacheSerializableRunnableException}.
*/
- public final void run() {
+ public void run() {
try {
if (args == null) {
run2();
@@ -68,7 +68,7 @@ public abstract class CacheSerializableRunnable extends SerializableRunnable
* repeat the {@link #run} method until it either succeeds or repeatTimeoutMs milliseconds have
* passed. The AssertionError is only thrown to the caller if the last run still throws it.
*/
- public final void runRepeatingIfNecessary(long repeatTimeoutMs) {
+ public void runRepeatingIfNecessary(long repeatTimeoutMs) {
long start = System.currentTimeMillis();
AssertionError lastErr = null;
do {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java b/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
index db92dc8..3b56748 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/RegionTestCase.java
@@ -124,12 +124,12 @@ public abstract class RegionTestCase extends JUnit4CacheTestCase {
*
* @see #getRegionAttributes
*/
- protected final Region createRegion(String name) throws CacheException {
+ protected Region createRegion(String name) throws CacheException {
return createRegion(name, getRegionAttributes());
}
- protected final Region createRootRegion() throws CacheException {
+ protected Region createRootRegion() throws CacheException {
return createRootRegion(getRegionAttributes());
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
index c8a629c..e801392 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TXDistributedDUnitTest.java
@@ -399,7 +399,7 @@ public class TXDistributedDUnitTest extends JUnit4CacheTestCase {
rgn2.destroyRegion();
}
- static final void setInternalCallbacks(TXStateInterface txp, final byte[] cbSensors) {
+ static void setInternalCallbacks(TXStateInterface txp, final byte[] cbSensors) {
((TXStateProxyImpl) txp).forceLocalBootstrap();
TXState tx = (TXState) ((TXStateProxyImpl) txp).getRealDeal(null, null);
assertEquals(9, cbSensors.length);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
index 37f67e8..3004ea8 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheCallback.java
@@ -77,7 +77,7 @@ public abstract class TestCacheCallback implements CacheCallback {
return this.isClosed;
}
- public final void close() {
+ public void close() {
this.isClosed = true;
close2();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
index db318d5..b7f811a 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheListener.java
@@ -86,7 +86,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
}
}
- public final void afterCreate(EntryEvent event) {
+ public void afterCreate(EntryEvent event) {
addEvent(event);
try {
afterCreate2(event);
@@ -103,7 +103,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterUpdate(EntryEvent event) {
+ public void afterUpdate(EntryEvent event) {
addEvent(event);
try {
afterUpdate2(event);
@@ -120,7 +120,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterInvalidate(EntryEvent event) {
+ public void afterInvalidate(EntryEvent event) {
addEvent(event);
try {
afterInvalidate2(event);
@@ -137,7 +137,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterDestroy(EntryEvent event) {
+ public void afterDestroy(EntryEvent event) {
afterDestroyBeforeAddEvent(event);
addEvent(event);
try {
@@ -159,7 +159,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterRegionInvalidate(RegionEvent event) {
+ public void afterRegionInvalidate(RegionEvent event) {
addEvent(event);
try {
afterRegionInvalidate2(event);
@@ -176,7 +176,7 @@ public abstract class TestCacheListener extends TestCacheCallback implements Cac
throw new UnsupportedOperationException(s);
}
- public final void afterRegionDestroy(RegionEvent event) {
+ public void afterRegionDestroy(RegionEvent event) {
// check argument to see if this is during tearDown
if ("teardown".equals(event.getCallbackArgument()))
return;
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
index d9158a5..8f91515 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheLoader.java
@@ -27,7 +27,7 @@ import org.apache.geode.cache.*;
*/
public abstract class TestCacheLoader extends TestCacheCallback implements CacheLoader {
- public final Object load(LoaderHelper helper) throws CacheLoaderException {
+ public Object load(LoaderHelper helper) throws CacheLoaderException {
this.invoked = true;
return load2(helper);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
index 95d7f75..ea1ed1a 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestCacheWriter.java
@@ -29,7 +29,7 @@ import org.apache.geode.cache.*;
public abstract class TestCacheWriter extends TestCacheCallback implements CacheWriter {
- public final void beforeUpdate(EntryEvent event) throws CacheWriterException {
+ public void beforeUpdate(EntryEvent event) throws CacheWriterException {
this.invoked = true;
beforeUpdate2(event);
@@ -41,13 +41,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
throw new UnsupportedOperationException(s);
}
- public final void beforeUpdate2(EntryEvent event, Object arg) throws CacheWriterException {
+ public void beforeUpdate2(EntryEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeCreate(EntryEvent event) throws CacheWriterException {
+ public void beforeCreate(EntryEvent event) throws CacheWriterException {
this.invoked = true;
beforeCreate2(event);
@@ -62,13 +62,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
/**
* Causes code that uses the old API to not compile
*/
- public final void beforeCreate2(EntryEvent event, Object arg) throws CacheWriterException {
+ public void beforeCreate2(EntryEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeDestroy(EntryEvent event) throws CacheWriterException {
+ public void beforeDestroy(EntryEvent event) throws CacheWriterException {
this.invoked = true;
beforeDestroy2(event);
@@ -80,13 +80,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
throw new UnsupportedOperationException(s);
}
- public final void beforeDestroy2(EntryEvent event, Object arg) throws CacheWriterException {
+ public void beforeDestroy2(EntryEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeRegionDestroy(RegionEvent event) throws CacheWriterException {
+ public void beforeRegionDestroy(RegionEvent event) throws CacheWriterException {
// check argument to see if this is during tearDown
if ("teardown".equals(event.getCallbackArgument()))
@@ -102,14 +102,13 @@ public abstract class TestCacheWriter extends TestCacheCallback implements Cache
throw new UnsupportedOperationException(s);
}
- public final void beforeRegionDestroy2(RegionEvent event, Object arg)
- throws CacheWriterException {
+ public void beforeRegionDestroy2(RegionEvent event, Object arg) throws CacheWriterException {
String s = "Shouldn't be invoked";
throw new UnsupportedOperationException(s);
}
- public final void beforeRegionClear(RegionEvent event) throws CacheWriterException {
+ public void beforeRegionClear(RegionEvent event) throws CacheWriterException {
String s = "Unexpected callback invocation";
throw new UnsupportedOperationException(s);
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java b/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
index 2b75ccc..d29cb3c 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/TestTransactionListener.java
@@ -28,7 +28,7 @@ import org.apache.geode.cache.*;
public abstract class TestTransactionListener extends TestCacheCallback
implements TransactionListener {
- public final void afterCommit(TransactionEvent event) {
+ public void afterCommit(TransactionEvent event) {
this.invoked = true;
try {
afterCommit2(event);
@@ -45,7 +45,7 @@ public abstract class TestTransactionListener extends TestCacheCallback
throw new UnsupportedOperationException(s);
}
- public final void afterFailedCommit(TransactionEvent event) {
+ public void afterFailedCommit(TransactionEvent event) {
this.invoked = true;
try {
afterFailedCommit2(event);
@@ -63,7 +63,7 @@ public abstract class TestTransactionListener extends TestCacheCallback
}
- public final void afterRollback(TransactionEvent event) {
+ public void afterRollback(TransactionEvent event) {
this.invoked = true;
try {
afterRollback2(event);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
index 416b459..46d51e8 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLauncherTest.java
@@ -20,6 +20,9 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import org.apache.commons.lang.StringUtils;
import org.apache.geode.test.junit.categories.UnitTest;
@@ -50,6 +53,13 @@ public class AbstractLauncherTest {
}
@Test
+ public void shouldBeMockable() throws Exception {
+ AbstractLauncher mockAbstractLauncher = mock(AbstractLauncher.class);
+ mockAbstractLauncher.setDebug(true);
+ verify(mockAbstractLauncher, times(1)).setDebug(true);
+ }
+
+ @Test
public void testIsSet() {
final Properties properties = new Properties();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
index 2a6dfa6..4117d25 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractLocatorLauncherRemoteIntegrationTestCase.java
@@ -58,7 +58,7 @@ public abstract class AbstractLocatorLauncherRemoteIntegrationTestCase
/**
* Remove final if a test needs to override.
*/
- protected final AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
+ protected AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
return AbstractLauncher.Status.NOT_RESPONDING;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java b/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
index d3aa05b..b50b77a 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/AbstractServerLauncherRemoteIntegrationTestCase.java
@@ -62,7 +62,7 @@ public abstract class AbstractServerLauncherRemoteIntegrationTestCase
/**
* Remove final if a test needs to override.
*/
- protected final AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
+ protected AbstractLauncher.Status getExpectedStopStatusForNotRunning() {
return AbstractLauncher.Status.NOT_RESPONDING;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
index 50cea4d..0281a37 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherTest.java
@@ -21,15 +21,16 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import org.apache.geode.distributed.LocatorLauncher.Builder;
import org.apache.geode.distributed.LocatorLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;
@@ -40,7 +41,6 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import joptsimple.OptionException;
-
/**
* The LocatorLauncherTest class is a test suite of test cases for testing the contract and
* functionality of launching a GemFire Locator.
@@ -61,9 +61,16 @@ public class LocatorLauncherTest {
@Rule
public final TestName testName = new TestName();
- @Before
- public void setup() {
- DistributedSystem.removeSystem(InternalDistributedSystem.getConnectedInstance());
+ @Test
+ public void shouldBeMockable() throws Exception {
+ LocatorLauncher mockLocatorLauncher = mock(LocatorLauncher.class);
+ InternalLocator mockInternalLocator = mock(InternalLocator.class);
+
+ when(mockLocatorLauncher.getLocator()).thenReturn(mockInternalLocator);
+ when(mockLocatorLauncher.getId()).thenReturn("ID");
+
+ assertThat(mockLocatorLauncher.getLocator()).isSameAs(mockInternalLocator);
+ assertThat(mockLocatorLauncher.getId()).isEqualTo("ID");
}
@Test(expected = IllegalArgumentException.class)
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
index 98f73d8..9611e32 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
@@ -15,12 +15,18 @@
package org.apache.geode.distributed;
import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.server.CacheServer;
@@ -29,6 +35,7 @@ import org.apache.geode.distributed.ServerLauncher.Command;
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.support.DistributedSystemAdapter;
+import org.apache.geode.internal.cache.CacheConfig;
import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.UnitTest;
@@ -93,6 +100,29 @@ public class ServerLauncherTest {
}
@Test
+ public void shouldBeMockable() throws Exception {
+ ServerLauncher mockServerLauncher = mock(ServerLauncher.class);
+ Cache mockCache = mock(Cache.class);
+ CacheConfig mockCacheConfig = mock(CacheConfig.class);
+
+ when(mockServerLauncher.getCache()).thenReturn(mockCache);
+ when(mockServerLauncher.getCacheConfig()).thenReturn(mockCacheConfig);
+ when(mockServerLauncher.getId()).thenReturn("ID");
+ when(mockServerLauncher.isWaiting(eq(mockCache))).thenReturn(true);
+ when(mockServerLauncher.isHelping()).thenReturn(true);
+
+ mockServerLauncher.startCacheServer(mockCache);
+
+ verify(mockServerLauncher, times(1)).startCacheServer(mockCache);
+
+ assertThat(mockServerLauncher.getCache()).isSameAs(mockCache);
+ assertThat(mockServerLauncher.getCacheConfig()).isSameAs(mockCacheConfig);
+ assertThat(mockServerLauncher.getId()).isSameAs("ID");
+ assertThat(mockServerLauncher.isWaiting(mockCache)).isTrue();
+ assertThat(mockServerLauncher.isHelping()).isTrue();
+ }
+
+ @Test
public void testParseCommand() {
Builder builder = new Builder();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java
new file mode 100644
index 0000000..ab5124a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionAdvisorTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributionAdvisorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributionAdvisor mockDistributionAdvisor = mock(DistributionAdvisor.class);
+ mockDistributionAdvisor.initialize();
+ verify(mockDistributionAdvisor, times(1)).initialize();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java
new file mode 100644
index 0000000..5e37c18
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionManagerTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.concurrent.Executor;
+
+@Category(UnitTest.class)
+public class DistributionManagerTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ Executor mockExecutor = mock(Executor.class);
+ when(mockDistributionManager.getExecutor(anyInt(), eq(mockInternalDistributedMember)))
+ .thenReturn(mockExecutor);
+ assertThat(mockDistributionManager.getExecutor(1, mockInternalDistributedMember))
+ .isSameAs(mockExecutor);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java
new file mode 100644
index 0000000..df6e7c5
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/DistributionMessageTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributionMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributionMessage mockDistributionMessage = mock(DistributionMessage.class);
+ ReplySender mockReplySender = mock(ReplySender.class);
+
+ mockDistributionMessage.setReplySender(mockReplySender);
+
+ verify(mockDistributionMessage, times(1)).setReplySender(mockReplySender);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java
new file mode 100644
index 0000000..224e845
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/ReplyProcessor21Test.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.distributed.internal;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ReplyProcessor21Test {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ReplyProcessor21 mockReplyProcessor21 = mock(ReplyProcessor21.class);
+
+ mockReplyProcessor21.waitForRepliesUninterruptibly();
+ mockReplyProcessor21.finished();
+
+ verify(mockReplyProcessor21, times(1)).waitForRepliesUninterruptibly();
+ verify(mockReplyProcessor21, times(1)).finished();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java b/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java
new file mode 100644
index 0000000..88105d3
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractConfigTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractConfig mockAbstractConfig = mock(AbstractConfig.class);
+ when(mockAbstractConfig.toString()).thenReturn("STRING");
+ assertThat(mockAbstractConfig.toString()).isEqualTo("STRING");
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
index 2f853db..12e20c7 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java
@@ -3283,7 +3283,7 @@ public class DataSerializableJUnitTest implements Serializable {
}
@Override
- public final void newDataSerializer(DataSerializer ds) {
+ public void newDataSerializer(DataSerializer ds) {
this.invoked = true;
try {
newDataSerializer2(ds);
@@ -3302,7 +3302,7 @@ public class DataSerializableJUnitTest implements Serializable {
}
@Override
- public final void newInstantiator(Instantiator instantiator) {
+ public void newInstantiator(Instantiator instantiator) {
this.invoked = true;
try {
newInstantiator2(instantiator);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java b/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java
new file mode 100644
index 0000000..fa79ff2
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/HeapDataOutputStreamTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class HeapDataOutputStreamTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ HeapDataOutputStream mockHeapDataOutputStream = mock(HeapDataOutputStream.class);
+ Version mockVersion = mock(Version.class);
+ when(mockHeapDataOutputStream.getVersion()).thenReturn(mockVersion);
+ assertThat(mockHeapDataOutputStream.getVersion()).isEqualTo(mockVersion);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java b/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java
new file mode 100644
index 0000000..4d9f480
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/ObjIdConcurrentMapTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.ObjIdConcurrentMap.Segment;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ObjIdConcurrentMapTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ObjIdConcurrentMap mockObjIdConcurrentMap = mock(ObjIdConcurrentMap.class);
+ Segment mockSegment = mock(Segment.class);
+
+ when(mockObjIdConcurrentMap.segmentFor(anyInt())).thenReturn(mockSegment);
+
+ assertThat(mockObjIdConcurrentMap.segmentFor(0)).isEqualTo(mockSegment);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java
new file mode 100644
index 0000000..d994fe9
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractDiskRegionTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractDiskRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractDiskRegion mockAbstractDiskRegion = mock(AbstractDiskRegion.class);
+ DiskStoreImpl mockDiskStoreImpl = mock(DiskStoreImpl.class);
+ DiskId mockDiskId = mock(DiskId.class);
+ Object object = new Object();
+
+ when(mockAbstractDiskRegion.getDiskStore()).thenReturn(mockDiskStoreImpl);
+ when(mockAbstractDiskRegion.getRaw(eq(mockDiskId))).thenReturn(object);
+
+ assertThat(mockAbstractDiskRegion.getDiskStore()).isEqualTo(mockDiskStoreImpl);
+ assertThat(mockAbstractDiskRegion.getRaw(mockDiskId)).isEqualTo(object);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java
new file mode 100644
index 0000000..abead95
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractLRURegionMapTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractLRURegionMapTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractLRURegionMap mockAbstractLRURegionMap = mock(AbstractLRURegionMap.class);
+
+ when(mockAbstractLRURegionMap.centralizedLruUpdateCallback()).thenReturn(1);
+
+ mockAbstractLRURegionMap.audit();
+ mockAbstractLRURegionMap.changeTotalEntrySize(1);
+
+ verify(mockAbstractLRURegionMap, times(1)).audit();
+ verify(mockAbstractLRURegionMap, times(1)).changeTotalEntrySize(1);
+
+ assertThat(mockAbstractLRURegionMap.centralizedLruUpdateCallback()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java
new file mode 100644
index 0000000..5043f09
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractOplogDiskRegionEntryTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractOplogDiskRegionEntryTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractOplogDiskRegionEntry mockAbstractOplogDiskRegionEntry =
+ mock(AbstractOplogDiskRegionEntry.class);
+ LocalRegion mockLocalRegion = mock(LocalRegion.class);
+
+ mockAbstractOplogDiskRegionEntry.removePhase1(mockLocalRegion, true);
+
+ verify(mockAbstractOplogDiskRegionEntry, times(1)).removePhase1(mockLocalRegion, true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
index eee588e..60b93a9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionMapTest.java
@@ -14,21 +14,46 @@
*/
package org.apache.geode.internal.cache;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyBoolean;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import org.apache.geode.cache.DataPolicy;
import org.apache.geode.cache.EntryNotFoundException;
import org.apache.geode.cache.Operation;
+import org.apache.geode.internal.cache.versions.VersionHolder;
import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
@Category(UnitTest.class)
public class AbstractRegionMapTest {
@Test
+ public void shouldBeMockable() throws Exception {
+ AbstractRegionMap mockAbstractRegionMap = mock(AbstractRegionMap.class);
+ RegionEntry mockRegionEntry = mock(RegionEntry.class);
+ VersionHolder mockVersionHolder = mock(VersionHolder.class);
+
+ when(mockAbstractRegionMap.removeTombstone(eq(mockRegionEntry), eq(mockVersionHolder),
+ anyBoolean(), anyBoolean())).thenReturn(true);
+
+ assertThat(
+ mockAbstractRegionMap.removeTombstone(mockRegionEntry, mockVersionHolder, true, true))
+ .isTrue();
+ }
+
+ @Test
public void invalidateOfNonExistentRegionThrowsEntryNotFound() {
TestableAbstractRegionMap arm = new TestableAbstractRegionMap();
EntryEventImpl event = createEventForInvalidate(arm.owner);
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java
new file mode 100644
index 0000000..adbfa02
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AbstractRegionTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class AbstractRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ AbstractRegion mockAbstractRegion = mock(AbstractRegion.class);
+ long millis = System.currentTimeMillis();
+
+ when(mockAbstractRegion.isAllEvents()).thenReturn(true);
+ when(mockAbstractRegion.cacheTimeMillis()).thenReturn(millis);
+
+ assertThat(mockAbstractRegion.isAllEvents()).isTrue();
+ assertThat(mockAbstractRegion.cacheTimeMillis()).isEqualTo(millis);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java
new file mode 100644
index 0000000..2b17f36
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/BucketAdvisorTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class BucketAdvisorTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ BucketAdvisor mockBucketAdvisor = mock(BucketAdvisor.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+
+ when(mockBucketAdvisor.basicGetPrimaryMember()).thenReturn(mockInternalDistributedMember);
+ when(mockBucketAdvisor.getBucketRedundancy()).thenReturn(1);
+
+ assertThat(mockBucketAdvisor.basicGetPrimaryMember()).isEqualTo(mockInternalDistributedMember);
+ assertThat(mockBucketAdvisor.getBucketRedundancy()).isEqualTo(1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
index 3d0be6a..5718055 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug37377DUnitTest.java
@@ -267,11 +267,11 @@ public class Bug37377DUnitTest extends JUnit4CacheTestCase {
private static RegionEntryFactory factory = new RegionEntryFactory() {
- public final RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
return new TestAbstractDiskRegionEntry(r, key, value);
}
- public final Class getEntryClass() {
+ public Class getEntryClass() {
return TestAbstractDiskRegionEntry.class;
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
index 6dc52ba..1a4e51e 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug39079DUnitTest.java
@@ -305,12 +305,12 @@ public class Bug39079DUnitTest extends JUnit4CacheTestCase {
private static RegionEntryFactory factory = new RegionEntryFactory() {
@Override
- public final RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
+ public RegionEntry createEntry(RegionEntryContext r, Object key, Object value) {
throw new DiskAccessException(new IOException("Test Exception"));
}
@Override
- public final Class getEntryClass() {
+ public Class getEntryClass() {
return getClass();
}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java
new file mode 100644
index 0000000..3e60ef2
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheOperationMessageTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class CacheOperationMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ CacheOperationMessage mockCacheOperationMessage = mock(CacheOperationMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+
+ when(mockCacheOperationMessage.supportsDirectAck()).thenReturn(true);
+ when(mockCacheOperationMessage._mayAddToMultipleSerialGateways(eq(mockDistributionManager)))
+ .thenReturn(true);
+
+ mockCacheOperationMessage.process(mockDistributionManager);
+
+ verify(mockCacheOperationMessage, times(1)).process(mockDistributionManager);
+
+ assertThat(mockCacheOperationMessage.supportsDirectAck()).isTrue();
+ assertThat(mockCacheOperationMessage._mayAddToMultipleSerialGateways(mockDistributionManager))
+ .isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java
new file mode 100644
index 0000000..8ffbdaf
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DestroyMessageTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.DestroyOperation.DestroyMessage;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DestroyMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DestroyMessage mockDestroyOperation = mock(DestroyMessage.class);
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+ InternalCacheEvent mockInternalCacheEvent = mock(InternalCacheEvent.class);
+
+ when(mockDestroyOperation.createEvent(eq(mockDistributedRegion)))
+ .thenReturn(mockInternalCacheEvent);
+
+ assertThat(mockDestroyOperation.createEvent(mockDistributedRegion))
+ .isEqualTo(mockInternalCacheEvent);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
index dd29c74..81747f1 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegCacheXmlJUnitTest.java
@@ -240,7 +240,7 @@ public class DiskRegCacheXmlJUnitTest {
}
/** Close the cache */
- private synchronized final void closeCache() {
+ private synchronized void closeCache() {
if (cache != null) {
try {
if (!cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
index 63e6d62..8a99972 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionClearJUnitTest.java
@@ -120,7 +120,7 @@ public class DiskRegionClearJUnitTest {
}
/** Close the cache */
- private static synchronized final void closeCache() {
+ private static synchronized void closeCache() {
if (cache != null) {
try {
if (!cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
index 913d56d..2d3ac3a 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DiskRegionTestingBase.java
@@ -175,7 +175,7 @@ public abstract class DiskRegionTestingBase {
}
/** Close the cache */
- private static synchronized final void closeCache() {
+ private static synchronized void closeCache() {
if (cache != null) {
try {
if (!cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java
new file mode 100644
index 0000000..f2806fe
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistPeerTXStateStubTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.internal.cache.tx.DistTxEntryEvent;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+
+@Category(UnitTest.class)
+public class DistPeerTXStateStubTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistPeerTXStateStub mockDistPeerTXStateStub = mock(DistPeerTXStateStub.class);
+ DistTxEntryEvent mockDistTxEntryEvent = mock(DistTxEntryEvent.class);
+ ArrayList<DistTxEntryEvent> arrayOfDistTxEntryEvents = new ArrayList<>();
+ arrayOfDistTxEntryEvents.add(mockDistTxEntryEvent);
+
+ when(mockDistPeerTXStateStub.getPrimaryTransactionalOperations())
+ .thenReturn(arrayOfDistTxEntryEvents);
+
+ assertThat(mockDistPeerTXStateStub.getPrimaryTransactionalOperations())
+ .isSameAs(arrayOfDistTxEntryEvents);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java
new file mode 100644
index 0000000..cba7c98
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedCacheOperationTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.DistributedCacheOperation.CacheOperationMessage;
+import org.apache.geode.internal.cache.persistence.PersistentMemberID;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Category(UnitTest.class)
+public class DistributedCacheOperationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedCacheOperation mockDistributedCacheOperation = mock(DistributedCacheOperation.class);
+ CacheOperationMessage mockCacheOperationMessage = mock(CacheOperationMessage.class);
+ Map<InternalDistributedMember, PersistentMemberID> persistentIds = new HashMap<>();
+ when(mockDistributedCacheOperation.supportsDirectAck()).thenReturn(false);
+
+ mockDistributedCacheOperation.waitForAckIfNeeded(mockCacheOperationMessage, persistentIds);
+
+ verify(mockDistributedCacheOperation, times(1)).waitForAckIfNeeded(mockCacheOperationMessage,
+ persistentIds);
+
+ assertThat(mockDistributedCacheOperation.supportsDirectAck()).isFalse();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java
new file mode 100644
index 0000000..3d60475
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedPutAllOperationTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedPutAllOperationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedPutAllOperation mockDistributedPutAllOperation =
+ mock(DistributedPutAllOperation.class);
+ EntryEventImpl mockEntryEventImpl = mock(EntryEventImpl.class);
+
+ when(mockDistributedPutAllOperation.getBaseEvent()).thenReturn(mockEntryEventImpl);
+
+ assertThat(mockDistributedPutAllOperation.getBaseEvent()).isSameAs(mockEntryEventImpl);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java
new file mode 100644
index 0000000..7c6aebc
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionFunctionStreamingMessageTest.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedRegionFunctionStreamingMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedRegionFunctionStreamingMessage mockDistributedRegionFunctionStreamingMessage =
+ mock(DistributedRegionFunctionStreamingMessage.class);
+ DistributionManager mockDistributionManager = mock(DistributionManager.class);
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+
+ when(mockDistributedRegionFunctionStreamingMessage
+ .operateOnDistributedRegion(eq(mockDistributionManager), eq(mockDistributedRegion)))
+ .thenReturn(true);
+
+ assertThat(mockDistributedRegionFunctionStreamingMessage
+ .operateOnDistributedRegion(mockDistributionManager, mockDistributedRegion)).isTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java
new file mode 100644
index 0000000..67b0c6c
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRegionTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedRegionTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
+ EntryEventImpl mockEntryEventImpl = mock(EntryEventImpl.class);
+ Object returnValue = new Object();
+
+ when(mockDistributedRegion.validatedDestroy(anyObject(), eq(mockEntryEventImpl)))
+ .thenReturn(returnValue);
+
+ assertThat(mockDistributedRegion.validatedDestroy(new Object(), mockEntryEventImpl))
+ .isSameAs(returnValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java
new file mode 100644
index 0000000..42780db
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/DistributedRemoveAllOperationTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class DistributedRemoveAllOperationTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ DistributedRemoveAllOperation mockDistributedRemoveAllOperation =
+ mock(DistributedRemoveAllOperation.class);
+ EntryEventImpl mockEntryEventImpl = mock(EntryEventImpl.class);
+
+ when(mockDistributedRemoveAllOperation.getBaseEvent()).thenReturn(mockEntryEventImpl);
+
+ assertThat(mockDistributedRemoveAllOperation.getBaseEvent()).isSameAs(mockEntryEventImpl);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java
new file mode 100644
index 0000000..4bcebda
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ExpiryTaskTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class ExpiryTaskTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ ExpiryTask mockExpiryTask = mock(ExpiryTask.class);
+ mockExpiryTask.run2();
+ verify(mockExpiryTask, times(1)).run2();
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
index a24fc5a..d867959 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
@@ -14,6 +14,7 @@
*/
package org.apache.geode.internal.cache;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
@@ -22,6 +23,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import org.apache.geode.internal.cache.control.InternalResourceManager;
import org.awaitility.Awaitility;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -38,6 +40,17 @@ import org.apache.geode.test.junit.categories.UnitTest;
public class GemFireCacheImplTest {
@Test
+ public void shouldBeMockable() throws Exception {
+ GemFireCacheImpl mockGemFireCacheImpl = mock(GemFireCacheImpl.class);
+ InternalResourceManager mockInternalResourceManager = mock(InternalResourceManager.class);
+
+ when(mockGemFireCacheImpl.getInternalResourceManager()).thenReturn(mockInternalResourceManager);
+
+ assertThat(mockGemFireCacheImpl.getInternalResourceManager())
+ .isSameAs(mockInternalResourceManager);
+ }
+
+ @Test
public void checkPurgeCCPTimer() {
InternalDistributedSystem ds = Fakes.distributedSystem();
CacheConfig cc = new CacheConfig();
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java
new file mode 100644
index 0000000..afaa04b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/GridProfileTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.DistributionAdvisor.Profile;
+import org.apache.geode.distributed.internal.DistributionAdvisor.ProfileId;
+import org.apache.geode.internal.cache.GridAdvisor.GridProfile;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Category(UnitTest.class)
+public class GridProfileTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ GridProfile mockGridProfile = mock(GridProfile.class);
+ ProfileId mockProfileId = mock(ProfileId.class);
+ List<Profile> listOfProfiles = new ArrayList<>();
+ listOfProfiles.add(mock(Profile.class));
+
+ when(mockGridProfile.getHost()).thenReturn("HOST");
+ when(mockGridProfile.getPort()).thenReturn(1);
+ when(mockGridProfile.getId()).thenReturn(mockProfileId);
+
+ mockGridProfile.setHost("host");
+ mockGridProfile.setPort(2);
+ mockGridProfile.tellLocalControllers(true, true, listOfProfiles);
+ mockGridProfile.tellLocalBridgeServers(true, true, listOfProfiles);
+
+ verify(mockGridProfile, times(1)).setHost("host");
+ verify(mockGridProfile, times(1)).setPort(2);
+ verify(mockGridProfile, times(1)).tellLocalControllers(true, true, listOfProfiles);
+ verify(mockGridProfile, times(1)).tellLocalBridgeServers(true, true, listOfProfiles);
+
+ assertThat(mockGridProfile.getHost()).isEqualTo("HOST");
+ assertThat(mockGridProfile.getPort()).isEqualTo(1);
+ assertThat(mockGridProfile.getId()).isSameAs(mockProfileId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode/blob/97a6e1ae/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java
new file mode 100644
index 0000000..b9cb872
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/MemberFunctionStreamingMessageTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(UnitTest.class)
+public class MemberFunctionStreamingMessageTest {
+
+ @Test
+ public void shouldBeMockable() throws Exception {
+ MemberFunctionStreamingMessage mockMemberFunctionStreamingMessage =
+ mock(MemberFunctionStreamingMessage.class);
+ InternalDistributedMember mockInternalDistributedMember = mock(InternalDistributedMember.class);
+ when(mockMemberFunctionStreamingMessage.getMemberToMasqueradeAs())
+ .thenReturn(mockInternalDistributedMember);
+ assertThat(mockMemberFunctionStreamingMessage.getMemberToMasqueradeAs())
+ .isSameAs(mockInternalDistributedMember);
+ }
+}