### Question:
Utils { public static boolean isIndexingConfigAvailable() throws RegistryException { String configPath = CarbonUtils.getRegistryXMLPath(); File registryXML = new File(configPath); FileInputStream fileInputStream; try { fileInputStream = new FileInputStream(registryXML); } catch (FileNotFoundException e) { String msg = "Registry configuration file (registry.xml) file doesn't exist in the path " + configPath; log.error(msg, e); throw new RegistryException(msg); } StAXOMBuilder builder; try { builder = new StAXOMBuilder( CarbonUtils.replaceSystemVariablesInXml(fileInputStream)); OMElement configElement = builder.getDocumentElement(); if (configElement != null) { OMElement indexingConfig = configElement.getFirstChildWithName( new QName("indexingConfiguration")); return indexingConfig != null; } } catch (XMLStreamException e) { String msg = "Failed to read <indexingConfiguration/> from registry.xml"; log.error(msg, e); throw new RegistryException(msg); } catch (CarbonException e) { String msg = "Failed to read <indexingConfiguration/> from registry.xml"; log.error(msg, e); throw new RegistryException(msg); } return false; }  static void setRegistryService(RegistryService service); static RegistryService getRegistryService(); static WaitBeforeShutdownObserver[] getWaitBeforeShutdownObservers(); static void setWaitBeforeShutdownObserver(WaitBeforeShutdownObserver service); static void clearWaitBeforeShutdownObserver(); static Registry getRegistry(); static String getDefaultEventingServiceURL(); static void setDefaultEventingServiceURL(String defaultEventingServiceURL); static String getRemoteTopicHeaderName(); static void setRemoteTopicHeaderName(String remoteTopicHeaderName); static String getRemoteTopicHeaderNS(); static void setRemoteTopicHeaderNS(String remoteTopicHeaderNS); static String getRemoteSubscriptionStoreContext(); static void setRemoteSubscriptionStoreContext(String remoteSubscriptionStoreContext); static boolean isIndexingConfigAvailable();  }### Answer:
@Test public void testIsIndexingConfigAvailable() throws Exception { Path registryPath = IndexingTestUtils.getResourcePath("registry-indexing.xml"); System.setProperty("wso2.registry.xml", registryPath.toString()); System.setProperty("carbon.home", registryPath.toString()); assertTrue(Utils.isIndexingConfigAvailable()); System.clearProperty("wso2.registry.xml"); System.clearProperty("carbon.home"); }
@Test(expected = RegistryException.class) public void testReadIndexingConfigWithInvalidPath() throws RegistryException { Path registryPath = IndexingTestUtils.getResourcePath("registry-1.xml"); System.setProperty("wso2.registry.xml", registryPath.toString()); System.setProperty("carbon.home", registryPath.toString()); assertTrue(Utils.isIndexingConfigAvailable()); System.clearProperty("wso2.registry.xml"); System.clearProperty("carbon.home"); }
@Test(expected = RegistryException.class) public void testReadIndexingConfigWithInvalidContent() throws RegistryException { Path registryPath = IndexingTestUtils.getResourcePath("registry-invalid.xml"); System.setProperty("wso2.registry.xml", registryPath.toString()); System.setProperty("carbon.home", registryPath.toString()); assertTrue(Utils.isIndexingConfigAvailable()); System.clearProperty("wso2.registry.xml"); System.clearProperty("carbon.home"); }