Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Jan 19, 2024
1 parent d9362fc commit a71f62c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ protected void afterScenario(TestCaseFinished event) {
currentScenarioContextMap.remove(Pair.of(context.getLine(), featureUri));
Date endTime = finishTestItem(context.getId(), event.getResult().getStatus());
featureEndTime.put(featureUri, endTime);
currentScenarioContext.set(null);
currentScenarioContext.remove();
removeFromTree(currentFeatureContextMap.get(context.getFeatureUri()), context);
}

Expand Down
13 changes: 6 additions & 7 deletions src/main/java/com/epam/reportportal/cucumber/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.cucumber.plugin.event.Status;
import io.cucumber.plugin.event.TestStep;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -77,12 +76,12 @@ public static String buildName(String prefix, String infix, String argument) {
}

public static Method retrieveMethod(Object stepDefinitionMatch) throws IllegalAccessException, NoSuchFieldException {
Field stepDefinitionField = stepDefinitionMatch.getClass().getDeclaredField(STEP_DEFINITION_FIELD_NAME);
stepDefinitionField.setAccessible(true);
Object javaStepDefinition = stepDefinitionField.get(stepDefinitionMatch);
Field methodField = javaStepDefinition.getClass().getSuperclass().getDeclaredField(METHOD_FIELD_NAME);
methodField.setAccessible(true);
return (Method) methodField.get(javaStepDefinition);
Object javaStepDefinition = Accessible.on(stepDefinitionMatch).field(STEP_DEFINITION_FIELD_NAME).getValue();
Method method = null;
if (javaStepDefinition != null) {
method = (Method) Accessible.on(javaStepDefinition).field(METHOD_FIELD_NAME).getValue();
}
return method;
}

public static final java.util.function.Function<List<Argument>, List<?>> ARGUMENTS_TRANSFORM = arguments -> ofNullable(arguments).map(
Expand Down

0 comments on commit a71f62c

Please sign in to comment.