mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-06 20:39:26 +01:00
161 lines
6.1 KiB
Java
161 lines
6.1 KiB
Java
package org.junit.runner;
|
|
|
|
import java.io.IOException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
import java.io.ObjectStreamClass;
|
|
import java.io.ObjectStreamField;
|
|
import java.io.Serializable;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
import org.junit.runner.notification.Failure;
|
|
import org.junit.runner.notification.RunListener;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes11.dex */
|
|
public class Result implements Serializable {
|
|
private static final ObjectStreamField[] serialPersistentFields = ObjectStreamClass.lookup(SerializedForm.class).getFields();
|
|
private static final long serialVersionUID = 1;
|
|
private final AtomicInteger count;
|
|
private final CopyOnWriteArrayList<Failure> failures;
|
|
private final AtomicInteger ignoreCount;
|
|
private final AtomicLong runTime;
|
|
private SerializedForm serializedForm;
|
|
private final AtomicLong startTime;
|
|
|
|
private Result(SerializedForm serializedForm) {
|
|
this.count = serializedForm.fCount;
|
|
this.ignoreCount = serializedForm.fIgnoreCount;
|
|
this.failures = new CopyOnWriteArrayList<>(serializedForm.fFailures);
|
|
this.runTime = new AtomicLong(serializedForm.fRunTime);
|
|
this.startTime = new AtomicLong(serializedForm.fStartTime);
|
|
}
|
|
|
|
private void readObject(ObjectInputStream objectInputStream) throws ClassNotFoundException, IOException {
|
|
this.serializedForm = SerializedForm.deserialize(objectInputStream);
|
|
}
|
|
|
|
private Object readResolve() {
|
|
return new Result(this.serializedForm);
|
|
}
|
|
|
|
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
|
|
new SerializedForm(this).serialize(objectOutputStream);
|
|
}
|
|
|
|
public RunListener createListener() {
|
|
return new Listener();
|
|
}
|
|
|
|
public int getFailureCount() {
|
|
return this.failures.size();
|
|
}
|
|
|
|
public List<Failure> getFailures() {
|
|
return this.failures;
|
|
}
|
|
|
|
public int getIgnoreCount() {
|
|
return this.ignoreCount.get();
|
|
}
|
|
|
|
public int getRunCount() {
|
|
return this.count.get();
|
|
}
|
|
|
|
public long getRunTime() {
|
|
return this.runTime.get();
|
|
}
|
|
|
|
public boolean wasSuccessful() {
|
|
return getFailureCount() == 0;
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RunListener.ThreadSafe
|
|
public class Listener extends RunListener {
|
|
private Listener() {
|
|
}
|
|
|
|
@Override // org.junit.runner.notification.RunListener
|
|
public void testFailure(Failure failure) throws Exception {
|
|
Result.this.failures.add(failure);
|
|
}
|
|
|
|
@Override // org.junit.runner.notification.RunListener
|
|
public void testFinished(Description description) throws Exception {
|
|
Result.this.count.getAndIncrement();
|
|
}
|
|
|
|
@Override // org.junit.runner.notification.RunListener
|
|
public void testIgnored(Description description) throws Exception {
|
|
Result.this.ignoreCount.getAndIncrement();
|
|
}
|
|
|
|
@Override // org.junit.runner.notification.RunListener
|
|
public void testRunFinished(Result result) throws Exception {
|
|
Result.this.runTime.addAndGet(System.currentTimeMillis() - Result.this.startTime.get());
|
|
}
|
|
|
|
@Override // org.junit.runner.notification.RunListener
|
|
public void testRunStarted(Description description) throws Exception {
|
|
Result.this.startTime.set(System.currentTimeMillis());
|
|
}
|
|
|
|
@Override // org.junit.runner.notification.RunListener
|
|
public void testAssumptionFailure(Failure failure) {
|
|
}
|
|
}
|
|
|
|
public Result() {
|
|
this.count = new AtomicInteger();
|
|
this.ignoreCount = new AtomicInteger();
|
|
this.failures = new CopyOnWriteArrayList<>();
|
|
this.runTime = new AtomicLong();
|
|
this.startTime = new AtomicLong();
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static class SerializedForm implements Serializable {
|
|
private static final long serialVersionUID = 1;
|
|
private final AtomicInteger fCount;
|
|
private final List<Failure> fFailures;
|
|
private final AtomicInteger fIgnoreCount;
|
|
private final long fRunTime;
|
|
private final long fStartTime;
|
|
|
|
private SerializedForm(ObjectInputStream.GetField getField) throws IOException {
|
|
this.fCount = (AtomicInteger) getField.get("fCount", (Object) null);
|
|
this.fIgnoreCount = (AtomicInteger) getField.get("fIgnoreCount", (Object) null);
|
|
this.fFailures = (List) getField.get("fFailures", (Object) null);
|
|
this.fRunTime = getField.get("fRunTime", 0L);
|
|
this.fStartTime = getField.get("fStartTime", 0L);
|
|
}
|
|
|
|
public static SerializedForm deserialize(ObjectInputStream objectInputStream) throws ClassNotFoundException, IOException {
|
|
return new SerializedForm(objectInputStream.readFields());
|
|
}
|
|
|
|
public void serialize(ObjectOutputStream objectOutputStream) throws IOException {
|
|
ObjectOutputStream.PutField putFields = objectOutputStream.putFields();
|
|
putFields.put("fCount", this.fCount);
|
|
putFields.put("fIgnoreCount", this.fIgnoreCount);
|
|
putFields.put("fFailures", this.fFailures);
|
|
putFields.put("fRunTime", this.fRunTime);
|
|
putFields.put("fStartTime", this.fStartTime);
|
|
objectOutputStream.writeFields();
|
|
}
|
|
|
|
public SerializedForm(Result result) {
|
|
this.fCount = result.count;
|
|
this.fIgnoreCount = result.ignoreCount;
|
|
this.fFailures = Collections.synchronizedList(new ArrayList(result.failures));
|
|
this.fRunTime = result.runTime.longValue();
|
|
this.fStartTime = result.startTime.longValue();
|
|
}
|
|
}
|
|
}
|