Fix Region.getEntry() for a given key by returning null if the Optional is empty.
This commit is contained in:
@@ -1413,7 +1413,8 @@ public abstract class MockGemFireObjectsSupport extends MockObjectsSupport {
|
|||||||
data.get(invocation.<K>getArgument(0)));
|
data.get(invocation.<K>getArgument(0)));
|
||||||
|
|
||||||
when(mockRegion.getEntry(ArgumentMatchers.<K>any())).thenAnswer(invocation ->
|
when(mockRegion.getEntry(ArgumentMatchers.<K>any())).thenAnswer(invocation ->
|
||||||
data.entrySet().stream().filter(entry -> entry.getKey().equals(invocation.getArgument(0))).findFirst());
|
data.entrySet().stream().filter(entry -> entry.getKey().equals(invocation.getArgument(0))).findFirst()
|
||||||
|
.orElse(null));
|
||||||
|
|
||||||
when(mockRegion.put(any(), any())).thenAnswer(invocation ->
|
when(mockRegion.put(any(), any())).thenAnswer(invocation ->
|
||||||
data.put(invocation.getArgument(0), invocation.getArgument(1)));
|
data.put(invocation.getArgument(0), invocation.getArgument(1)));
|
||||||
|
|||||||
Reference in New Issue
Block a user