Skip to content

Commit

Permalink
Use FakeClock since ArtificialClock has been removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
apcj committed Dec 4, 2015
1 parent 61feb81 commit 60a65f4
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -24,8 +24,9 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import org.neo4j.helpers.FakeClock;
import org.neo4j.kernel.lifecycle.LifeSupport;
import org.neo4j.test.ArtificialClock;

import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.hamcrest.CoreMatchers.equalTo;
Expand Down Expand Up @@ -117,7 +118,7 @@ public void shouldNotTimeOutWhenStopped() throws Throwable
// given
final AtomicLong timeoutCount = new AtomicLong();

ArtificialClock clock = new ArtificialClock();
FakeClock clock = new FakeClock();

DelayedRenewableTimeoutService timeoutService = new DelayedRenewableTimeoutService( clock );

Expand All @@ -126,7 +127,7 @@ public void shouldNotTimeOutWhenStopped() throws Throwable

life.add( timeoutService );

clock.progress( 1000, MILLISECONDS );
clock.forward( 1000, MILLISECONDS );
Thread.sleep( 5 ); // to make sure the scheduled thread has checked time elapsed

assertThat( timeoutCount.get(), equalTo( 1L ) );
Expand All @@ -136,7 +137,7 @@ public void shouldNotTimeOutWhenStopped() throws Throwable

timeout.renew();
Thread.sleep( 5 );
clock.progress( 1000, MILLISECONDS );
clock.forward( 1000, MILLISECONDS );
Thread.sleep( 5 );

assertThat( timeoutCount.get(), equalTo( 1L ) );
Expand Down

0 comments on commit 60a65f4

Please sign in to comment.