### Question:
TransactionPropagator implements Lifecycle { public static Configuration from( final Config config ) { return new Configuration() { @Override public int getTxPushFactor() { return config.get( HaSettings.tx_push_factor ); } @Override public InstanceId getServerId() { return config.get( ClusterSettings.server_id ); } @Override public SlavePriority getReplicationStrategy() { switch ( config.get( HaSettings.tx_push_strategy ) ) { case fixed_descending: return SlavePriorities.fixedDescending(); case fixed_ascending: return SlavePriorities.fixedAscending(); case round_robin: return SlavePriorities.roundRobin(); default: throw new RuntimeException( "Unknown replication strategy " ); } } }; } TransactionPropagator( Configuration config, Log log, Slaves slaves, CommitPusher pusher ); static Configuration from( final Config config ); static Configuration from( final Config config, final SlavePriority slavePriority ); @Override void init(); @Override void start(); @Override void stop(); @Override void shutdown(); int committed( long txId, int authorId );  }### Answer:
@Test public void shouldPrioritizeAscendingIfAsked() { Configuration propagator = TransactionPropagator .from( Config.defaults( tx_push_strategy, fixed_ascending.name() ) ); SlavePriority strategy = propagator.getReplicationStrategy(); Iterable<Slave> prioritize = strategy.prioritize( asList( slave( 1 ), slave( 0 ), slave( 2 ) ) ); assertThat( Iterables.asList( prioritize ), equalTo( asList( slave( 0 ), slave( 1 ), slave( 2 ) ) ) ); }
@Test public void shouldPrioritizeDescendingIfAsked() { Configuration propagator = TransactionPropagator .from( Config.defaults( tx_push_strategy, fixed_descending.name() ) ); SlavePriority strategy = propagator.getReplicationStrategy(); Iterable<Slave> prioritize = strategy.prioritize( asList( slave( 1 ), slave( 0 ), slave( 2 ) ) ); assertThat( Iterables.asList(prioritize), equalTo( asList( slave( 2 ), slave( 1 ), slave( 0 ) ) ) ); }