Refactor TestAttempt event posting code

For flaky tests, Bazel may have cached information about multiple test attempts. In that case, we might want to post all of them on a subsequent cache hit, rather than posting only the passing attempt.

We currently subclass TestResult inside Google, which overrides the new getCachedTestAttempts method.

PiperOrigin-RevId: 196491575
diff --git a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
index c1248a6..91d8297 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java
@@ -165,7 +165,7 @@
       actionExecutionContext
           .getEventHandler()
           .post(
-              new TestAttempt(
+              TestAttempt.forExecutedTestResult(
                   action,
                   standaloneTestResult.executionInfo(),
                   attempt,
@@ -242,7 +242,7 @@
     actionExecutionContext
         .getEventHandler()
         .post(
-            new TestAttempt(
+            TestAttempt.forExecutedTestResult(
                 action,
                 result.executionInfo(),
                 attempt,