Buggy code:
@ Override protected File getSolrXml ( ) throws Exception { } @ Override protected void deleteAdditionalFiles ( ) { } protected SolrServer getSolrAdmin ( ) { } protected SolrServer getRenamedSolrAdmin ( ) { } @ Test public void testProperties ( ) throws Exception { UpdateRequest up = new UpdateRequest ( ) ; up . setAction ( COMMIT , true , true ) ; up . deleteByQuery ( "*:*" ) ; up . process ( getSolrCore0 ( ) ) ; up . process ( getSolrCore1 ( ) ) ; up . clear ( ) ; SolrInputDocument doc = new SolrInputDocument ( ) ; doc . setField ( "id" , "AAA" ) ; doc . setField ( "core0" , "yup<seq2seq4repair_space>stopfra<seq2seq4repair_space>stopfrb<seq2seq4repair_space>stopena<seq2seq4repair_space>stopenb" ) ; up . add ( doc ) ; up . process ( getSolrCore0 ( ) ) ; SolrTestCaseJ4 . ignoreException ( "unknown<seq2seq4repair_space>field" ) ; try { up . process ( getSolrCore1 ( ) ) ; fail ( "Can't<seq2seq4repair_space>add<seq2seq4repair_space>core0<seq2seq4repair_space>field<seq2seq4repair_space>to<seq2seq4repair_space>core1!" ) ; } catch ( Exception ex ) { } doc . setField ( "id" , "BBB" ) ; doc . setField ( "core1" , "yup<seq2seq4repair_space>stopfra<seq2seq4repair_space>stopfrb<seq2seq4repair_space>stopena<seq2seq4repair_space>stopenb" ) ; doc . removeField ( "core0" ) ; up . add ( doc ) ; up . process ( getSolrCore1 ( ) ) ; try { SolrTestCaseJ4 . ignoreException ( "core0" ) ; up . process ( getSolrCore0 ( ) ) ; fail ( "Can't<seq2seq4repair_space>add<seq2seq4repair_space>core1<seq2seq4repair_space>field<seq2seq4repair_space>to<seq2seq4repair_space>core0!" ) ; } catch ( Exception ex ) { } SolrTestCaseJ4 . resetExceptionIgnores ( ) ; SolrQuery q = new SolrQuery ( ) ; QueryRequest r = new QueryRequest ( q ) ; q . setQuery ( "id:AAA" ) ; assertEquals ( 1 , r . process ( getSolrCore0 ( ) ) . getResults ( ) . size ( ) ) ; assertEquals ( 0 , r . process ( getSolrCore1 ( ) ) . getResults ( ) . size ( ) ) ; assertEquals ( 1 , getSolrCore0 ( ) . query ( new SolrQuery ( "id:AAA" ) ) . getResults ( ) . size ( ) ) ; assertEquals ( 0 , getSolrCore0 ( ) . query ( new SolrQuery ( "id:BBB" ) ) . getResults ( ) . size ( ) ) ; assertEquals ( 0 , getSolrCore1 ( ) . query ( new SolrQuery ( "id:AAA" ) ) . getResults ( ) . size ( ) ) ; assertEquals ( 1 , getSolrCore1 ( ) . query ( new SolrQuery ( "id:BBB" ) ) . getResults ( ) . size ( ) ) ; String name = "core0" ; SolrServer coreadmin = getSolrAdmin ( ) ; CoreAdminResponse mcr = CoreAdminRequest . getStatus ( name , coreadmin ) ; long before = mcr . getStartTime ( name ) . getTime ( ) ; CoreAdminRequest . reloadCore ( name , coreadmin ) ; mcr = CoreAdminRequest . getStatus ( name , coreadmin ) ; long after = mcr . getStartTime ( name ) . getTime ( ) ; assertTrue ( ( ( ( "should<seq2seq4repair_space>have<seq2seq4repair_space>more<seq2seq4repair_space>recent<seq2seq4repair_space>time:<seq2seq4repair_space>" + after ) + "," ) + before ) , ( after > before ) ) ; mcr = CoreAdminRequest . persist ( TestSolrProperties . SOLR_PERSIST_XML , coreadmin ) ; DocumentBuilder builder = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; FileInputStream fis = new FileInputStream ( new File ( tempDir , TestSolrProperties . SOLR_PERSIST_XML ) ) ; try { Document document = builder . parse ( fis ) ; fis . close ( ) ; fis = new FileInputStream ( new File ( tempDir , TestSolrProperties . SOLR_PERSIST_XML ) ) ; String solrPersistXml = IOUtils . toString ( new InputStreamReader ( fis , "UTF-8" ) ) ; assertTrue ( ( "\"//solr//cores[@defaultCoreName=\'core0\']\"<seq2seq4repair_space>doesn\'t<seq2seq4repair_space>match<seq2seq4repair_space>in:\n" + solrPersistXml ) , TestSolrProperties . exists ( "//solr//cores[@defaultCoreName='core0']" , document ) ) ; assertTrue ( ( "\"//solr//cores[@host=\'127.0.0.1\']\"<seq2seq4repair_space>doesn\'t<seq2seq4repair_space>match<seq2seq4repair_space>in:\n" + solrPersistXml ) , TestSolrProperties . exists ( "//solr//cores[@host='127.0.0.1']" , document ) ) ; assertTrue ( ( "\"//solr//cores[@hostPort=\'${hostPort:8983}\']\"<seq2seq4repair_space>doesn\'t<seq2seq4repair_space>match<seq2seq4repair_space>in:\n" + solrPersistXml ) , TestSolrProperties . exists ( "//solr//cores[@hostPort='${hostPort:8983}']" , document ) ) ; assertTrue ( ( "\"//solr//cores[@zkClientTimeout=\'8000\']\"<seq2seq4repair_space>doesn\'t<seq2seq4repair_space>match<seq2seq4repair_space>in:\n" + solrPersistXml ) , TestSolrProperties . exists ( "//solr//cores[@zkClientTimeout='8000']" , document ) ) ; assertTrue ( ( "\"//solr//cores[@hostContext=\'${hostContext:solr}\']\"<seq2seq4repair_space>doesn\'t<seq2seq4repair_space>match<seq2seq4repair_space>in:\n" + solrPersistXml ) , TestSolrProperties . exists ( "//solr//cores[@hostContext='${hostContext:solr}']" , document ) ) ; } finally { fis . close ( ) ; } CoreAdminRequest . renameCore ( name , "renamed_core" , coreadmin ) ; mcr = CoreAdminRequest . persist ( TestSolrProperties . SOLR_PERSIST_XML , getRenamedSolrAdmin ( ) ) ; fis = new FileInputStream ( new File ( tempDir , TestSolrProperties . SOLR_PERSIST_XML ) ) ; try { Document document = builder . parse ( fis ) ; assertTrue ( TestSolrProperties . exists ( "//solr//cores//core[@name='renamed_core']" , document ) ) ; assertTrue ( TestSolrProperties . exists ( "//solr//cores//core[@instanceDir='${theInstanceDir:.//}']" , document ) ) ; assertTrue ( TestSolrProperties . exists ( "//solr//cores//core[@collection='${collection:acollection}']" , document ) ) ; } finally { fis . close ( ) ; } coreadmin = getRenamedSolrAdmin ( ) ; File dataDir = new File ( tempDir , "data3" ) ; File tlogDir = new File ( tempDir , "tlog3" ) ; CoreAdminRequest . createCore ( "newCore" , SOLR_HOME . getAbsolutePath ( ) , coreadmin , null , null , dataDir . getAbsolutePath ( ) , tlogDir . getAbsolutePath ( ) ) ; mcr = CoreAdminRequest . persist ( TestSolrProperties . SOLR_PERSIST_XML , getRenamedSolrAdmin ( ) ) ; fis = new FileInputStream ( new File ( tempDir , TestSolrProperties . SOLR_PERSIST_XML ) ) ; try { Document document = builder . parse ( fis ) ; <START_BUG> assertTrue ( TestSolrProperties . exists ( "//solr//cores//core[@name=\'collection1\'<seq2seq4repair_space>and<seq2seq4repair_space>(@instanceDir=\'.//\'<seq2seq4repair_space>or<seq2seq4repair_space>@instanceDir=\'.\\\')]" , document ) ) ; <END_BUG> } finally { fis . close ( ) ; } cores . shutdown ( ) ; cores = new org . apache . solr . core . CoreContainer ( SOLR_HOME . getAbsolutePath ( ) , new File ( tempDir , TestSolrProperties . SOLR_PERSIST_XML ) ) ; mcr = CoreAdminRequest . persist ( TestSolrProperties . SOLR_PERSIST_XML , getRenamedSolrAdmin ( ) ) ; } public static boolean exists ( String xpathStr , Node node ) throws XPathExpressionException { } }

Fix:
assertTrue ( TestSolrProperties . exists ( "//solr//cores//core[@name='collection1'<seq2seq4repair_space>and<seq2seq4repair_space>@instanceDir='.']" , document ) ) ;