### Question:
StateTransitionLogger implements StateTransitionListener { @Override public void stateTransition( StateTransition transition ) { Log log = logProvider.getLog( transition.getOldState().getClass() ); if ( log.isDebugEnabled() ) { if ( transition.getOldState() == HeartbeatState.heartbeat ) { return; } String state = transition.getOldState().getClass().getSuperclass().getSimpleName(); StringBuilder line = new StringBuilder( state ).append( ": " ).append( transition ); if ( transition.getMessage().hasHeader( HEADER_FROM ) ) { line.append( " from:" ).append( transition.getMessage().getHeader( HEADER_FROM ) ); } if ( transition.getMessage().hasHeader( INSTANCE ) ) { line.append( " instance:" ).append( transition.getMessage().getHeader( INSTANCE ) ); } if ( transition.getMessage().hasHeader( HEADER_CONVERSATION_ID ) ) { line.append( " conversation-id:" ).append( transition.getMessage().getHeader( HEADER_CONVERSATION_ID ) ); } Object payload = transition.getMessage().getPayload(); if ( payload != null ) { if ( payload instanceof Payload ) { try { payload = atomicBroadcastSerializer.receive( (Payload) payload ); } catch ( Throwable e ) { } } line.append( " payload:" ).append( Strings.prettyPrint( payload ) ); } String msg = line.toString(); if ( msg.equals( lastLogMessage ) ) { return; } log.debug( line.toString() ); lastLogMessage = msg; } } StateTransitionLogger( LogProvider logProvider, AtomicBroadcastSerializer atomicBroadcastSerializer ); @Override void stateTransition( StateTransition transition );  }### Answer:
@Test public void shouldThrottle() { AssertableLogProvider logProvider = new AssertableLogProvider( true ); StateTransitionLogger stateLogger = new StateTransitionLogger( logProvider, new AtomicBroadcastSerializer( new ObjectStreamFactory(), new ObjectStreamFactory() ) ); stateLogger.stateTransition( new StateTransition( entered, Message.internal( join), joining ) ); stateLogger.stateTransition( new StateTransition( entered, Message.internal( join), joining ) ); stateLogger.stateTransition( new StateTransition( joining, Message.internal( join), entered ) ); stateLogger.stateTransition( new StateTransition( entered, Message.internal( join), joining ) ); logProvider.assertExactly( inLog( entered.getClass() ).debug( "ClusterState: entered-[join]->joining" ), inLog( joining.getClass() ).debug( "ClusterState: joining-[join]->entered" ), inLog( entered.getClass() ).debug( "ClusterState: entered-[join]->joining" ) ); }