You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: java_helpers.go
    path of file: ./repos/cockroach/pkg/cmd/roachtest/tests
    
    the code of the file until where you have to start completion: // Copyright 2019 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package tests

import (
	"context"
	"encoding/xml"
	"fmt"
	"strings"

	"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
	"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
	"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
)

// extractFailureFromJUnitXML parses an XML report to find all failed tests. The
// return values are:
//   - slice of all test names.
//   - slice of status for each test.

    
func extractFailureFromJUnitXML(contents []byte) ([]string, []status, map[string]string, error) {
	type Failure struct {
		Message string `xml:"message,attr"`
	}
	type Error struct {
		Message string `xml:"message,attr"`
	}
	type TestCase struct {
		Name      string    `xml:"name,attr"`
		ClassName string    `xml:"classname,attr"`
		Failure   Failure   `xml:"failure,omitempty"`
		Error     Error     `xml:"error,omitempty"`
		Skipped   *struct{} `xml:"skipped,omitempty"`
	}
	type TestSuite struct {
		XMLName   xml.Name   `xml:"testsuite"`
		TestCases []TestCase `xml:"testcase"`
	}
	type TestSuites struct {
		XMLName    xml.Name    `xml:"testsuites"`
		TestSuites []TestSuite `xml:"testsuite"`
	}

	var testSuite TestSuite
	_ = testSuite.XMLName
	var testSuites TestSuites
	_ = testSuites.XMLName

	var tests []string
	var testStatuses []status
	var failedTestToIssue = make(map[string]string)
	processTestSuite := func(testSuite TestSuite) {
		for _, testCase := range testSuite.TestCases {
			testName := fmt.Sprintf("%s.%s", testCase.ClassName, testCase.Name)
			testPassed := len(testCase.Failure.Message) == 0 && len(testCase.Error.Message) == 0
			tests = append(tests, testName)
			if testCase.Skipped != nil {
				testStatuses = append(testStatuses, statusSkip)
			} else if testPassed {
				testStatuses = append(testStatuses, statusPass)
			} else {
				testStatuses = append(testStatuses, statusFail)
				message := testCase.Failure.Message
				if len(message) == 0 {
					message = testCase.Error.Message
				}

				issue := "unknown"
				match := issueRegexp.FindStringSubmatch(message)
				if match != nil {
					issue = match[1]
				}
				failedTestToIssue[testName] = issue
			}
		}
	}

	// First, we try to parse the XML with an assumption that there are multiple
	// test suites in contents.
	if err := xml.Unmarshal(contents, &testSuites); err == nil {
		// The parsing was successful, so we process each test suite.
		for _, testSuite := range testSuites.TestSuites {
			processTestSuite(testSuite)
		}
	} else {
		// The parsing wasn't successful, so now we try to parse the XML with an
		// assumption that there is a single test suite.
		if err := xml.Unmarshal(contents, &testSuite); err != nil {
			return nil, nil, nil, err
		}
		processTestSuite(testSuite)
	}

	return tests, testStatuses, failedTestToIssue, nil
}