@Test(priority = 2) public void fetchApexClassIdFromNameTest() { String className = null; String expectedTestClassId = null; // pass empty string so that random classes gets picked soql = QueryConstructor.generateQueryToFetchApexClassesBasedOnRegex(null, "*"); // limit the result to 1 . Thats all we need to test the method // fetchApexClassIdFromName soql += " limit 1"; // the below call populates ApexClassFetcher.apexClassMap String[] testClasses = ApexClassFetcherUtils.constructClassIdArrayUsingWSC(conn, soql); if (testClasses != null && ApexClassFetcherUtils.apexClassMap != null) { for (String testClass : testClasses) { className = ApexClassFetcherUtils.apexClassMap.get(testClass); expectedTestClassId = testClass; } } soql = QueryConstructor.generateQueryToFetchApexClass(null, className); String testClassId = ApexClassFetcherUtils.fetchAndAddToMapApexClassIdBasedOnName(conn, soql); Assert.assertEquals(expectedTestClassId, testClassId); }