use of org.apache.geode.internal.cache.OffHeapRegionEntry in project geode by apache.
the class OffHeapRegionEntryHelperJUnitTest method releaseEntryShouldSetValueToRemovePhase2AndSetsAsyncToFalseForDiskEntry.
@Test
public void releaseEntryShouldSetValueToRemovePhase2AndSetsAsyncToFalseForDiskEntry() {
// mock region entry
OffHeapRegionEntry re = mock(VersionedStatsDiskRegionEntryOffHeap.class);
when(re.getAddress()).thenReturn(1L);
when(re.setAddress(1L, OffHeapRegionEntryHelper.REMOVED_PHASE2_ADDRESS)).thenReturn(Boolean.TRUE);
DiskId spy = Mockito.spy(DiskId.class);
when(((DiskEntry) re).getDiskId()).thenReturn(spy);
when(spy.isPendingAsync()).thenReturn(Boolean.TRUE);
// mock required methods
PowerMockito.spy(OffHeapRegionEntryHelper.class);
PowerMockito.doNothing().when(OffHeapRegionEntryHelper.class);
OffHeapRegionEntryHelper.setValue(re, Token.REMOVED_PHASE2);
OffHeapRegionEntryHelper.releaseEntry(re);
verify(spy, times(1)).setPendingAsync(Boolean.FALSE);
PowerMockito.verifyStatic();
OffHeapRegionEntryHelper.setValue(re, Token.REMOVED_PHASE2);
}
Aggregations