Skip to content

Commit 7a4fd94

Browse files
committed
Added enum TestCaseDetails
1 parent 6090a70 commit 7a4fd94

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package enums;
2+
3+
public enum TestCaseDetails {
4+
TESTCASEID,
5+
NAME,
6+
DESCRIPTION,
7+
EXECUTE
8+
}

src/main/java/listeners/MethodInterceptor.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.testng.IMethodInterceptor;
1111
import org.testng.ITestContext;
1212

13+
import enums.TestCaseDetails;
1314
import globalconstants.GlobalConstants;
1415
import utilities.filereaders.CsvReaderUtility;
1516

@@ -47,11 +48,11 @@ public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestConte
4748
private List<IMethodInstance> getListOfTestCasesToRun(List<IMethodInstance> methods, List<Map<String, String>> mapList){
4849
for(var method : methods){
4950
for(var map : mapList){
50-
if(method.getMethod().getMethodName().equalsIgnoreCase(map.get("name"))) {
51-
if(map.get("execute").equalsIgnoreCase("true")) {
52-
method.getMethod().setDescription(map.get("description"));
53-
testList.add(method);
54-
}
51+
if(method.getMethod().getMethodName().equalsIgnoreCase(map.get(TestCaseDetails.NAME.toString().toLowerCase())) &&
52+
map.get(TestCaseDetails.EXECUTE.toString().toLowerCase()).equalsIgnoreCase("true")) {
53+
54+
method.getMethod().setDescription(map.get(TestCaseDetails.DESCRIPTION.toString().toLowerCase()));
55+
testList.add(method);
5556
}
5657
}
5758
}

0 commit comments

Comments
 (0)