@Test(priority = 1) public void constructTestClassArrayUsingWSC() { soql = QueryConstructor.generateQueryToFetchApexClassesBasedOnRegex( null, CommandLineArguments.getTestRegex()); String[] testClasses = ApexClassFetcherUtils.constructClassIdArrayUsingWSC(conn, soql); logFilteredTestClasses(testClasses); if (testClasses != null) { Assert.assertTrue(testClasses.length > 0 || ApexClassFetcherUtils.apexClassMap.size() > 0); } }
@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); }
@Test(priority = 2) public void fetchApexClassNameFromIdTest() { String classId = null; String expectedClassName = 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 testClassId : testClasses) { expectedClassName = ApexClassFetcherUtils.apexClassMap.get(testClassId); classId = testClassId; } } if (classId != null) { HashMap<String, String> apexClassInfoMap = ApexClassFetcherUtils.fetchApexClassInfoFromId(conn, classId); String className = apexClassInfoMap.get("Name"); Assert.assertEquals(expectedClassName, className); } }