### Question:
Archiver implements Runnable { protected Archiver( String id, int maxWorkQueueSize, Duration maxPurgeInterval, Duration gracePeriod ) { if ( maxWorkQueueSize < 1 ) { throw new IllegalArgumentException( "Argument 'maxWorkQueueSize' must be a positive integer." ); } if ( gracePeriod.compareTo( maxPurgeInterval ) > 0 ) { throw new IllegalArgumentException( "Value for argument 'gracePeriod' cannot be larger than 'maxPurgeInterval'." ); } this.id = id; this.maxWorkQueueSize = maxWorkQueueSize; this.maxPurgeInterval = maxPurgeInterval; this.gracePeriod = gracePeriod; } protected  Archiver( String id, int maxWorkQueueSize, Duration maxPurgeInterval, Duration gracePeriod ); void archive( final E data ); String getId(); void run(); void stop(); Duration availabilityETA( Instant instant ); Duration availabilityETAOnLocalNode( final Instant instant ); int getMaxWorkQueueSize(); void setMaxWorkQueueSize( final int maxWorkQueueSize ); Duration getMaxPurgeInterval(); void setMaxPurgeInterval( final Duration maxPurgeInterval ); Duration getGracePeriod(); void setGracePeriod( final Duration gracePeriod );  }### Answer:
@Test public void testArchiver() throws Exception { final int maxWorkQueueSize = 100; final Duration maxPurgeInterval = Duration.ofMillis( 5000 ); final Duration gracePeriod = Duration.ofMillis( 50 ); final DummyArchiver archiver = new DummyArchiver( "test", maxWorkQueueSize, maxPurgeInterval, gracePeriod ); final Thread thread = new Thread( archiver ); try { thread.start(); archiver.archive( 1 ); waitUntilArchivingIsDone( archiver, 1 ); assertFalse( archiver.store.isEmpty() ); final Duration timeUntilLogged = Duration.between( archiver.getStarted(), archiver.store.get( 1 ) ); assertTrue( timeUntilLogged.compareTo( gracePeriod ) >= 0 ); assertTrue( timeUntilLogged.compareTo( maxPurgeInterval ) < 0 ); } finally { archiver.stop(); } }