Kirk Lund created GEODE-8040:
--------------------------------
Summary: BootstrappingFunctionIntegrationTest unintentionally
creates a full Cache stack
Key: GEODE-8040
URL: https://issues.apache.org/jira/browse/GEODE-8040
Project: Geode
Issue Type: Bug
Components: tests
Reporter: Kirk Lund
BootstrappingFunctionIntegrationTest unintentionally creates a full Cache stack.
The cause is improper syntax for partial mocking a Spy:
{noformat}
when(bootstrappingFunction.verifyCacheExists()).thenReturn(mockCache);
{noformat}
...which first invokes the actual verifyCacheExists() method which creates a
real Cache and then returns mockCache. This should instead be:
{noformat}
doReturn(mockCache).when(bootstrappingFunction).verifyCacheExists();
{noformat}
Unfortunately, the class BootstrappingFunction requires additional changes to
make it unit testable. The next test failure after fixing the Mockito syntax is:
{noformat}
org.apache.geode.cache.CacheClosedException: A cache has not yet been created.
at
org.apache.geode.internal.cache.CacheFactoryStatics.getAnyInstance(CacheFactoryStatics.java:87)
at
org.apache.geode.modules.util.CreateRegionFunction.<init>(CreateRegionFunction.java:59)
at
org.apache.geode.modules.util.BootstrappingFunction.registerFunctions(BootstrappingFunction.java:124)
at
org.apache.geode.modules.util.BootstrappingFunction.execute(BootstrappingFunction.java:67)
at
org.apache.geode.modules.util.BootstrappingFunctionIntegrationTest.registerFunctionGetsCalledOnNonLocators(BootstrappingFunctionIntegrationTest.java:101)
{noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)