Buggy code:
public class ReplicationRun_Local_StateTest_part1 extends ReplicationRun { public ReplicationRun_Local_StateTest_part1 ( String testcaseName ) { } public static Test suite ( ) { } public void testReplication_Local_StateTest_part1 ( ) throws Exception { } private void _testPreStartedMasterServer ( ) { } private void _testPreStartedSlaveServer ( ) { } private void _testPreInitSlave ( ) { } private void _testPreStartedSlave ( ) { } private void _testPreStartedMaster ( ) throws Exception { Connection conn = null ; String db = ( ( ( ( masterDatabasePath ) + ( FS ) ) + ( ReplicationRun . masterDbSubPath ) ) + ( FS ) ) + ( replicatedDb ) ; String connectionURL = ( ( ( ( ( ( ( ( ( ( "jdbc:derby:" + "////" ) + ( masterServerHost ) ) + ":" ) + ( masterServerPort ) ) + "//" ) + db ) + ";startMaster=true" ) + ";slaveHost=" ) + ( slaveServerHost ) ) + ";slavePort=" ) + ( slaveReplPort ) ; util . DEBUG ( ( "_testPreStartedMaster:<seq2seq4repair_space>" + connectionURL ) ) ; startMaster ( jvmVersion , replicatedDb , masterServerHost , masterServerPort , masterServerHost , slaveServerPort , slaveServerHost , slaveReplPort ) ; util . DEBUG ( ( "2.<seq2seq4repair_space>startMaster<seq2seq4repair_space>attempt<seq2seq4repair_space>should<seq2seq4repair_space>fail<seq2seq4repair_space>on:<seq2seq4repair_space>" + connectionURL ) ) ; { try { conn = DriverManager . getConnection ( connectionURL ) ; util . DEBUG ( ( "2.<seq2seq4repair_space>Unexpectedly<seq2seq4repair_space>connected<seq2seq4repair_space>as:<seq2seq4repair_space>" + connectionURL ) ) ; assertTrue ( ( "2.<seq2seq4repair_space>Unexpectedly<seq2seq4repair_space>connected<seq2seq4repair_space>as:<seq2seq4repair_space>" + connectionURL ) , false ) ; } catch ( SQLException se ) { int ec = se . getErrorCode ( ) ; String ss = se . getSQLState ( ) ; String msg = ( ( ( ec + "<seq2seq4repair_space>" ) + ss ) + "<seq2seq4repair_space>" ) + ( se . getMessage ( ) ) ; util . DEBUG ( ( "2.<seq2seq4repair_space>startMaster<seq2seq4repair_space>No<seq2seq4repair_space>connection<seq2seq4repair_space>as<seq2seq4repair_space>expected:<seq2seq4repair_space>" + msg ) ) ; assertTrue ( ( "2.<seq2seq4repair_space>Unexpected<seq2seq4repair_space>SQLException:<seq2seq4repair_space>" + msg ) , REPLICATION_MASTER_ALREADY_BOOTED . equals ( ss ) ) ; } } util . DEBUG ( ( "startSlave<seq2seq4repair_space>attempt<seq2seq4repair_space>should<seq2seq4repair_space>fail<seq2seq4repair_space>on:<seq2seq4repair_space>" + connectionURL ) ) ; db = ( ( ( ( slaveDatabasePath ) + ( FS ) ) + ( ReplicationRun . slaveDbSubPath ) ) + ( FS ) ) + ( replicatedDb ) ; connectionURL = ( ( ( ( ( ( ( ( ( ( "jdbc:derby:" + "////" ) + ( slaveServerHost ) ) + ":" ) + ( slaveServerPort ) ) + "//" ) + db ) + ";startSlave=true" ) + ";slaveHost=" ) + ( slaveServerHost ) ) + ";slavePort=" ) + ( slaveReplPort ) ; util . DEBUG ( connectionURL ) ; try { conn = DriverManager . getConnection ( connectionURL ) ; util . DEBUG ( ( "3.<seq2seq4repair_space>startSlave<seq2seq4repair_space>Unexpectedly<seq2seq4repair_space>connected<seq2seq4repair_space>as:<seq2seq4repair_space>" + connectionURL ) ) ; assertTrue ( ( "3.<seq2seq4repair_space>startSlave<seq2seq4repair_space>Unexpectedly<seq2seq4repair_space>connected<seq2seq4repair_space>as:<seq2seq4repair_space>" + connectionURL ) , false ) ; } catch ( SQLException se ) { int ec = se . getErrorCode ( ) ; String ss = se . getSQLState ( ) ; String msg = ( ( ( ec + "<seq2seq4repair_space>" ) + ss ) + "<seq2seq4repair_space>" ) + ( se . getMessage ( ) ) ; util . DEBUG ( ( "3.<seq2seq4repair_space>startSlave<seq2seq4repair_space>No<seq2seq4repair_space>connection<seq2seq4repair_space>as<seq2seq4repair_space>expected:<seq2seq4repair_space>" + msg ) ) ; <START_BUG> assertTrue ( ( "3.<seq2seq4repair_space>Unexpected<seq2seq4repair_space>SQLException:<seq2seq4repair_space>" + msg ) , CANNOT_START_SLAVE_ALREADY_BOOTED . equals ( ss ) ) ; <END_BUG> } } }

Fix:
assertTrue ( ( "3.<seq2seq4repair_space>Unexpected<seq2seq4repair_space>SQLException:<seq2seq4repair_space>" + msg ) , CANNOT_CONNECT_TO_DB_IN_SLAVE_MODE . startsWith ( ss ) ) ;