public class

TestDiscoveryErrorEvent

extends TestDiscoveryEvent

 java.lang.Object

androidx.test.services.events.discovery.TestDiscoveryEvent

↳androidx.test.services.events.discovery.TestDiscoveryErrorEvent

Gradle dependencies

compile group: 'androidx.test', name: 'runner', version: '1.6.2'

  • groupId: androidx.test
  • artifactId: runner
  • version: 1.6.2

Artifact androidx.test:runner:1.6.2 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.test:runner com.android.support.test:runner

Overview

This event is sent when an error is encountered during test discovery. Multiple TestDiscoveryErrorEvents may be reported. This event does not mean discovery has finished.

Summary

Fields
public final ErrorInfoerror

public final TimeStamptimeStamp

from TestDiscoveryEventCREATOR
Constructors
publicTestDiscoveryErrorEvent(ErrorInfo error, TimeStamp timeStamp)

Constructor to create TestDiscoveryErrorEvent.

Methods
public voidwriteToParcel(Parcel parcel, int i)

from TestDiscoveryEventdescribeContents
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public final ErrorInfo error

public final TimeStamp timeStamp

Constructors

public TestDiscoveryErrorEvent(ErrorInfo error, TimeStamp timeStamp)

Constructor to create TestDiscoveryErrorEvent.

Parameters:

error: the error that occurred.
timeStamp: the time when this error occurred.

Methods

public void writeToParcel(Parcel parcel, int i)

Source

/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.test.services.events.discovery;

import static androidx.test.internal.util.Checks.checkNotNull;

import android.os.Parcel;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.test.services.events.ErrorInfo;
import androidx.test.services.events.TimeStamp;

/**
 * This event is sent when an error is encountered during test discovery. Multiple {@link
 * TestDiscoveryErrorEvent}s may be reported. This event does not mean discovery has finished.
 *
 * @hide
 */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class TestDiscoveryErrorEvent extends TestDiscoveryEvent {
  /* The error that occurred */
  @NonNull public final ErrorInfo error;
  /* The time when this error occurred */
  @NonNull public final TimeStamp timeStamp;

  /**
   * Constructor to create {@link TestDiscoveryErrorEvent}.
   *
   * @param error the error that occurred.
   * @param timeStamp the time when this error occurred.
   */
  public TestDiscoveryErrorEvent(@NonNull ErrorInfo error, @NonNull TimeStamp timeStamp) {
    this.error = checkNotNull(error, "error cannot be null");
    this.timeStamp = checkNotNull(timeStamp, "timeStamp cannot be null");
  }

  /**
   * Creates a {@link TestDiscoveryErrorEvent} from an {@link Parcel}.
   *
   * @param source {@link Parcel} to create the {@link TestDiscoveryErrorEvent} from.
   */
  TestDiscoveryErrorEvent(Parcel source) {
    error = new ErrorInfo(source);
    timeStamp = new TimeStamp(source);
  }

  @Override
  EventType instanceType() {
    return EventType.ERROR;
  }

  @Override
  public void writeToParcel(Parcel parcel, int i) {
    super.writeToParcel(parcel, i);
    error.writeToParcel(parcel, i);
    timeStamp.writeToParcel(parcel, i);
  }
}