/**
  * Internal helper to get th SolrCore from the tracked SolrServer. This assumes that tracked
  * SolrServers are of type {@link EmbeddedSolrServer}.
  *
  * @param server the SolrServer
  * @return the SolrCore or <code>null</code> if <code>null</code> is parsed as server.
  * @throws IllegalStateException if the parsed {@link SolrServer} is not an {@link
  *     EmbeddedSolrServer} or it does not contain the configured SolrCore
  */
 private SolrCore getSolrCore(SolrServer server) {
   SolrCore core;
   if (server != null) {
     if (server instanceof EmbeddedSolrServer) {
       core = ((EmbeddedSolrServer) server).getCoreContainer().getCore(indexReference.getIndex());
       if (core == null) {
         throw new IllegalStateException(
             "Solr CoreContainer for IndexRef '"
                 + indexReference
                 + "'is missing the expected SolrCore '"
                 + indexReference.getIndex()
                 + "' (present: "
                 + ((EmbeddedSolrServer) server).getCoreContainer().getCoreNames()
                 + ")!");
       }
     } else {
       core = null;
       throw new IllegalStateException(
           "Unable to use '"
               + server.getClass().getSimpleName()
               + "' (indexRef: "
               + indexReference
               + ") because it is not an EmbeddedSolrServer!");
     }
   } else {
     core = null;
   }
   return core;
 }