//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void freeIdOnlyWhenReusabilityConditionAllows() public virtual void FreeIdOnlyWhenReusabilityConditionAllows() { ReplicatedIdRangeAcquirer rangeAcquirer = SimpleRangeAcquirer(IdType.NODE, 0, 1024); IdReusabilityCondition idReusabilityCondition = IdReusabilityCondition; long burnedIds = 23L; using (FreeIdFilteredIdGenerator idGenerator = new FreeIdFilteredIdGenerator(GetReplicatedIdGenerator(10, burnedIds, rangeAcquirer), idReusabilityCondition)) { idGenerator.FreeId(10); assertEquals(0, idGenerator.DefragCount); assertEquals(23, idGenerator.NextId()); when(_commandIndexTracker.AppliedCommandIndex).thenReturn(4L, 6L); // gap-free when(_state.lastLogIndexBeforeWeBecameLeader()).thenReturn(5L); idReusabilityCondition.OnLeaderSwitch(new LeaderInfo(_myself, 1)); assertEquals(24, idGenerator.NextId()); idGenerator.FreeId(11); assertEquals(25, idGenerator.NextId()); idGenerator.FreeId(6); assertEquals(6, idGenerator.NextId()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void freeIdOnlyWhenConditionSatisfied() public virtual void FreeIdOnlyWhenConditionSatisfied() { MutableBoolean condition = new MutableBoolean(); FreeIdFilteredIdGenerator generator = CreateFilteredIdGenerator(_idGenerator, condition.booleanValue); generator.FreeId(1); condition.setTrue(); generator.FreeId(2); verify(_idGenerator).freeId(2); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void skipFreeIdIfConditionIsNotSatisfied() public virtual void SkipFreeIdIfConditionIsNotSatisfied() { FreeIdFilteredIdGenerator generator = CreateFilteredIdGenerator(_idGenerator, () => false); generator.FreeId(1); verifyZeroInteractions(_idGenerator); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void freeIdIfConditionSatisfied() public virtual void FreeIdIfConditionSatisfied() { FreeIdFilteredIdGenerator generator = CreateFilteredIdGenerator(_idGenerator, () => true); generator.FreeId(1); verify(_idGenerator).freeId(1); }