geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [geode] branch feature/GEODE-4685 updated: GEODE-4685: Fixed LuceneEventListenerJUnitTest.java test failure
Date Tue, 06 Mar 2018 00:13:16 GMT
This is an automated email from the ASF dual-hosted git repository.

udo pushed a commit to branch feature/GEODE-4685
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-4685 by this push:
     new 268baa1  GEODE-4685: Fixed LuceneEventListenerJUnitTest.java test failure
268baa1 is described below

commit 268baa14f5a730338017ed0efc2e98944bde0a46
Author: Udo <ukohlmeyer@pivotal.io>
AuthorDate: Mon Mar 5 16:13:00 2018 -0800

    GEODE-4685: Fixed LuceneEventListenerJUnitTest.java test failure
---
 .../lucene/internal/LuceneEventListenerJUnitTest.java    | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneEventListenerJUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneEventListenerJUnitTest.java
index 0718f67..d7af3d4 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneEventListenerJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneEventListenerJUnitTest.java
@@ -20,9 +20,12 @@ import static org.junit.Assert.fail;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.atLeast;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -40,7 +43,9 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
+import org.mockito.stubbing.Answer;
 import org.powermock.api.mockito.PowerMockito;
 import org.powermock.core.classloader.annotations.PowerMockIgnore;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -57,6 +62,7 @@ import org.apache.geode.internal.cache.BucketNotFoundException;
 import org.apache.geode.internal.cache.EntrySnapshot;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.pdx.internal.TypeRegistry;
 import org.apache.geode.test.fake.Fakes;
 import org.apache.geode.test.junit.categories.UnitTest;
 
@@ -87,11 +93,17 @@ public class LuceneEventListenerJUnitTest {
 
   @Test
   public void pdxReadSerializedFlagShouldBeResetBackToOriginalValueAfterProcessingEvents()
{
+    ArgumentCaptor valueCapture = ArgumentCaptor.forClass(Boolean.class);
+    TypeRegistry mockTypeRegistry = cache.getPdxRegistry();
+    doNothing().when(mockTypeRegistry)
+        .setPdxReadSerializedOverride((Boolean) valueCapture.capture());
+
     boolean originalPdxReadSerialized = cache.getPdxRegistry().getPdxReadSerializedOverride();
     try {
       cache.getPdxRegistry().setPdxReadSerializedOverride(true);
-      listener.process(new LinkedList());
-      Assert.assertTrue(cache.getPdxRegistry().getPdxReadSerializedOverride());
+      Assert.assertTrue((Boolean) valueCapture.getValue());
+      listener.process(new LinkedList<>());
+      Assert.assertTrue(!(Boolean) valueCapture.getValue());
     } finally {
       cache.getPdxRegistry().setPdxReadSerializedOverride(originalPdxReadSerialized);
     }

-- 
To stop receiving notification emails like this one, please contact
udo@apache.org.

Mime
View raw message