### Question:
CountsTracker extends AbstractKeyValueStore<CountsKey> implements CountsVisitor.Visitable, CountsAccessor { public long rotate( long txId ) throws IOException { return prepareRotation( txId ).rotate(); } CountsTracker( final LogProvider logProvider, FileSystemAbstraction fs, PageCache pages, Config config,
            DatabaseLayout databaseLayout, VersionContextSupplier versionContextSupplier );  CountsTracker( final LogProvider logProvider, FileSystemAbstraction fs, PageCache pages, Config config,
                          DatabaseLayout databaseLayout, SystemNanoClock clock, VersionContextSupplier versionContextSupplier ); CountsTracker setInitializer( final DataInitializer<Updater> initializer ); long rotate( long txId ); long txId(); long minorVersion(); Register.DoubleLongRegister get( CountsKey key, Register.DoubleLongRegister target ); @Override Register.DoubleLongRegister nodeCount( int labelId, final Register.DoubleLongRegister target ); @Override Register.DoubleLongRegister relationshipCount( int startLabelId, int typeId, int endLabelId,
                                                          Register.DoubleLongRegister target ); @Override Register.DoubleLongRegister indexUpdatesAndSize( long indexId, Register.DoubleLongRegister target ); @Override Register.DoubleLongRegister indexSample( long indexId, Register.DoubleLongRegister target ); Optional<CountsAccessor.Updater> apply( long txId ); CountsAccessor.IndexStatsUpdater updateIndexCounts(); CountsAccessor.Updater reset( long txId ); @Override void accept( final CountsVisitor visitor ); static final String TYPE_DESCRIPTOR; }### Answer:
@Test public void shouldStoreCounts() throws Exception { CountsOracle oracle = someData(); try ( Lifespan life = new Lifespan() ) { CountsTracker tracker = life.add( newTracker() ); oracle.update( tracker, 2 ); tracker.rotate( 2 ); } try ( Lifespan life = new Lifespan() ) { oracle.verify( life.add( newTracker() ) ); } }
@Test public void shouldUpdateCountsOnExistingStore() throws Exception { CountsOracle oracle = someData(); int firstTx = 2; int secondTx = 3; try ( Lifespan life = new Lifespan() ) { CountsTracker tracker = life.add( newTracker() ); oracle.update( tracker, firstTx ); tracker.rotate( firstTx ); oracle.verify( tracker ); CountsOracle delta = new CountsOracle(); { CountsOracle.Node n1 = delta.node( 1 ); CountsOracle.Node n2 = delta.node( 1, 4 ); delta.relationship( n1, 1, n2 ); delta.relationship( n2, 2, n1 ); } delta.update( tracker, secondTx ); delta.update( oracle ); oracle.verify( tracker ); tracker.rotate( secondTx ); } try ( Lifespan life = new Lifespan() ) { oracle.verify( life.add( newTracker() ) ); } }