Skip to content

Commit

Permalink
MidpointTestContextWithTask: overriding previous context is now WARN
Browse files Browse the repository at this point in the history
It's not critical and previous throw was too harsh solution causing
failure in other tests initialization.
  • Loading branch information
virgo47 committed Aug 10, 2022
1 parent 2a9277a commit e528c20
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.tools.testng.MidpointTestContext;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;

/**
* Value object carrying test context information like task, result and method name.
Expand All @@ -19,6 +21,8 @@
*/
public final class MidpointTestContextWithTask implements MidpointTestContext {

private static final Trace LOGGER = TraceManager.getTrace(MidpointTestContextWithTask.class);

private static volatile MidpointTestContextWithTask testContext;

/**
Expand Down Expand Up @@ -78,7 +82,8 @@ public static MidpointTestContextWithTask create(
new MidpointTestContextWithTask(testClass, methodName, task, result);
Thread.currentThread().setName(ctx.getTestName());
if (testContext != null) {
throw new IllegalStateException("There is a testContext already, use destroy() properly: " + testContext);
LOGGER.warn("Previous testContext was not destroyed properly - offending test class: "
+ testContext.getTestClass());
}
testContext = ctx;
return ctx;
Expand Down

0 comments on commit e528c20

Please sign in to comment.