Skip to content

Commit

Permalink
GEODE-2558: Upgrade Powermock version to fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredjstewart authored and kirklund committed Jun 14, 2017
1 parent 0d43e3d commit b616e80
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,36 @@
*/
package org.apache.geode.internal.cache.tier.sockets.command;

import static org.assertj.core.api.Assertions.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;

import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import org.apache.geode.CancelCriterion;
import org.apache.geode.cache.operations.PutOperationContext;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.sockets.CacheServerStats;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.Message;
import org.apache.geode.internal.cache.tier.sockets.Part;
import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
import org.apache.geode.internal.security.AuthorizeRequest;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.security.NotAuthorizedException;
import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

@Category(UnitTest.class)
public class Put61Test {
Expand Down Expand Up @@ -107,7 +107,7 @@ public void setUp() throws Exception {

when(this.deltaPart.getObject()).thenReturn(true);

when(this.eventPart.getSerializedForm()).thenReturn(this.EVENT);
when(this.eventPart.getSerializedForm()).thenReturn(EVENT);

when(this.valuePart.getSerializedForm()).thenReturn(VALUE);
when(this.valuePart.isObject()).thenReturn(true);
Expand All @@ -132,7 +132,7 @@ public void setUp() throws Exception {
when(this.serverConnection.getClientVersion()).thenReturn(Version.CURRENT);

when(this.localRegion.basicBridgePut(eq(KEY), eq(VALUE), eq(VALUE), eq(true), eq(CALLBACK_ARG),
any(ClientProxyMembershipID.class), eq(true), any(EntryEventImpl.class))).thenReturn(true);
any(), eq(true), any())).thenReturn(true);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@
*/
package org.apache.geode.internal.cache.tier.sockets.command;

import static org.assertj.core.api.Assertions.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;

import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import org.apache.geode.CancelCriterion;
import org.apache.geode.cache.operations.PutOperationContext;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.TXManagerImpl;
import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.sockets.CacheServerStats;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.Message;
import org.apache.geode.internal.cache.tier.sockets.Part;
import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
import org.apache.geode.internal.security.AuthorizeRequest;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.security.NotAuthorizedException;
import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

@Category(UnitTest.class)
public class Put65Test {
Expand Down Expand Up @@ -122,7 +122,7 @@ public void setUp() throws Exception {
when(this.keyPart.getStringOrObject()).thenReturn(KEY);

when(this.localRegion.basicBridgePut(eq(KEY), eq(VALUE), eq(null), eq(true), eq(CALLBACK_ARG),
any(ClientProxyMembershipID.class), eq(true), any(EntryEventImpl.class))).thenReturn(true);
any(), eq(true), any())).thenReturn(true);

when(this.message.getNumberOfParts()).thenReturn(8);
when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,38 @@
*/
package org.apache.geode.internal.cache.tier.sockets.command;

import static org.assertj.core.api.Assertions.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;

import org.apache.geode.internal.cache.EventIDHolder;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.mockito.Mockito.anyBoolean;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.isNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import org.apache.geode.CancelCriterion;
import org.apache.geode.cache.operations.PutOperationContext;
import org.apache.geode.internal.Version;
import org.apache.geode.internal.cache.EntryEventImpl;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.internal.cache.tier.CachedRegionHelper;
import org.apache.geode.internal.cache.tier.sockets.CacheServerStats;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
import org.apache.geode.internal.cache.tier.sockets.Message;
import org.apache.geode.internal.cache.tier.sockets.Part;
import org.apache.geode.internal.cache.tier.sockets.ServerConnection;
import org.apache.geode.internal.security.AuthorizeRequest;
import org.apache.geode.internal.security.SecurityService;
import org.apache.geode.security.NotAuthorizedException;
import org.apache.geode.test.junit.categories.UnitTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

@Category(UnitTest.class)
public class PutTest {
Expand Down Expand Up @@ -129,10 +130,7 @@ public void setUp() throws Exception {
when(this.serverConnection.getClientVersion()).thenReturn(Version.CURRENT);

when(this.localRegion.basicBridgePut(eq(KEY), eq(VALUE), isNull(), eq(true), eq(CALLBACK_ARG),
isA(ClientProxyMembershipID.class), eq(true), isA(EntryEventImpl.class))).thenReturn(true);

// here's the actual call made by tests of basicBridgePut...
// region.basicBridgePut(key, value, null, isObject, callbackArg, serverConnection.getProxyID(), true, new EventIDHolder(eventId));
any(), anyBoolean(), any())).thenReturn(true);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,12 @@ public void invokeSuppliersShouldLogErrorOnlyOnce() {
assertEquals(1, stats.invokeSuppliers());

// String message, Object p0, Object p1, Object p2
verify(logger, times(1)).warn(anyString(), isNull(), anyInt(),
isA(NullPointerException.class));
verify(logger, times(1)).warn(anyString(), isNull(), anyInt(), isA(NullPointerException.class));

assertEquals(1, stats.invokeSuppliers());

// Make sure the logger isn't invoked again
verify(logger, times(1)).warn(anyString(), isNull(), anyInt(),
isA(NullPointerException.class));
verify(logger, times(1)).warn(anyString(), isNull(), anyInt(), isA(NullPointerException.class));
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions gradle/dependency-versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ junit-quickcheck.version = 0.7
JUnitParams.version = 1.0.6
log4j.version = 2.7
lucene.version = 6.4.1
mockito-core.version = 2.7.11
mockito-core.version = 2.8.9
mockrunner.version = 1.1.2
mortbay-jetty-servlet-api.version=3.0.20100224
multithreadedtc.version = 1.01
Expand All @@ -76,7 +76,7 @@ mx4j-tools.version = 3.0.1
netty-all.version = 4.1.8.Final
open-json.version = 1.8
phantomjsdriver.version=1.3.0
powermock.version = 1.7.0RC2
powermock.version = 1.7.0RC4
selenium.version=3.0.1
shiro.version=1.3.2
slf4j-api.version = 1.7.23
Expand Down

0 comments on commit b616e80

Please sign in to comment.