Skip to content

Commit

Permalink
Make Failure serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardhusmann committed Sep 19, 2024
1 parent 1be11f0 commit 6e6e342
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/java/eu/stamp_project/testrunner/runner/Failure.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.Optional;

/**
* This class contains the result of failing test method.
Expand All @@ -21,7 +20,7 @@ public class Failure implements Serializable {
public final String fullQualifiedNameOfException;
public final String messageOfFailure;
public final String stackTrace;
public final Optional<Throwable> throwable; // Throwable is not present if Failure is read from surefire report
public Throwable throwable; // Throwable is not present if Failure is read from surefire report

public Failure(String testCaseName, String testClassName, Throwable exception) {
this.testCaseName = testCaseName;
Expand All @@ -32,7 +31,7 @@ public Failure(String testCaseName, String testClassName, Throwable exception) {
PrintWriter pw = new PrintWriter(sw);
exception.printStackTrace(pw);
this.stackTrace = sw.toString(); // stack trace as a string
this.throwable = Optional.of(exception);
this.throwable = exception;
}

public Failure(String testCaseName, String testClassName, String fullQualifiedNameOfException, String messageOfFailure, String stackTrace) {
Expand All @@ -41,7 +40,6 @@ public Failure(String testCaseName, String testClassName, String fullQualifiedNa
this.messageOfFailure = messageOfFailure;
this.testClassName = testClassName;
this.stackTrace = stackTrace;
this.throwable = Optional.empty();
}

@Override
Expand Down

0 comments on commit 6e6e342

Please sign in to comment.