com.google.common.truth.extensions.proto.$AutoValue_DiffResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truth-proto-extension Show documentation
Show all versions of truth-proto-extension Show documentation
An extension for the Truth test assertion framework supporting
Protocol Buffers.
The newest version!
package com.google.common.truth.extensions.proto;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableListMultimap;
import com.google.protobuf.Message;
// Generated by com.google.auto.value.processor.AutoValueProcessor
abstract class $AutoValue_DiffResult extends DiffResult {
private final Message actual;
private final Message expected;
private final ImmutableListMultimap singularFields;
private final ImmutableListMultimap repeatedFields;
private final Optional unknownFields;
$AutoValue_DiffResult(
Message actual,
Message expected,
ImmutableListMultimap singularFields,
ImmutableListMultimap repeatedFields,
Optional unknownFields) {
if (actual == null) {
throw new NullPointerException("Null actual");
}
this.actual = actual;
if (expected == null) {
throw new NullPointerException("Null expected");
}
this.expected = expected;
if (singularFields == null) {
throw new NullPointerException("Null singularFields");
}
this.singularFields = singularFields;
if (repeatedFields == null) {
throw new NullPointerException("Null repeatedFields");
}
this.repeatedFields = repeatedFields;
if (unknownFields == null) {
throw new NullPointerException("Null unknownFields");
}
this.unknownFields = unknownFields;
}
@Override
Message actual() {
return actual;
}
@Override
Message expected() {
return expected;
}
@Override
ImmutableListMultimap singularFields() {
return singularFields;
}
@Override
ImmutableListMultimap repeatedFields() {
return repeatedFields;
}
@Override
Optional unknownFields() {
return unknownFields;
}
@Override
public String toString() {
return "DiffResult{"
+ "actual=" + actual + ", "
+ "expected=" + expected + ", "
+ "singularFields=" + singularFields + ", "
+ "repeatedFields=" + repeatedFields + ", "
+ "unknownFields=" + unknownFields
+ "}";
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof DiffResult) {
DiffResult that = (DiffResult) o;
return this.actual.equals(that.actual())
&& this.expected.equals(that.expected())
&& this.singularFields.equals(that.singularFields())
&& this.repeatedFields.equals(that.repeatedFields())
&& this.unknownFields.equals(that.unknownFields());
}
return false;
}
@Override
public int hashCode() {
int h$ = 1;
h$ *= 1000003;
h$ ^= actual.hashCode();
h$ *= 1000003;
h$ ^= expected.hashCode();
h$ *= 1000003;
h$ ^= singularFields.hashCode();
h$ *= 1000003;
h$ ^= repeatedFields.hashCode();
h$ *= 1000003;
h$ ^= unknownFields.hashCode();
return h$;
}
static class Builder extends DiffResult.Builder {
private Message actual;
private Message expected;
private ImmutableListMultimap.Builder singularFieldsBuilder$;
private ImmutableListMultimap singularFields;
private ImmutableListMultimap.Builder repeatedFieldsBuilder$;
private ImmutableListMultimap repeatedFields;
private Optional unknownFields = Optional.absent();
Builder() {
}
@Override
DiffResult.Builder setActual(Message actual) {
if (actual == null) {
throw new NullPointerException("Null actual");
}
this.actual = actual;
return this;
}
@Override
DiffResult.Builder setExpected(Message expected) {
if (expected == null) {
throw new NullPointerException("Null expected");
}
this.expected = expected;
return this;
}
@Override
ImmutableListMultimap.Builder singularFieldsBuilder() {
if (singularFieldsBuilder$ == null) {
singularFieldsBuilder$ = new ImmutableListMultimap.Builder();
}
return singularFieldsBuilder$;
}
@Override
ImmutableListMultimap.Builder repeatedFieldsBuilder() {
if (repeatedFieldsBuilder$ == null) {
repeatedFieldsBuilder$ = new ImmutableListMultimap.Builder();
}
return repeatedFieldsBuilder$;
}
@Override
DiffResult.Builder setUnknownFields(DiffResult.UnknownFieldSetDiff unknownFields) {
this.unknownFields = Optional.of(unknownFields);
return this;
}
@Override
DiffResult build() {
if (singularFieldsBuilder$ != null) {
this.singularFields = singularFieldsBuilder$.build();
} else if (this.singularFields == null) {
this.singularFields = ImmutableListMultimap.of();
}
if (repeatedFieldsBuilder$ != null) {
this.repeatedFields = repeatedFieldsBuilder$.build();
} else if (this.repeatedFields == null) {
this.repeatedFields = ImmutableListMultimap.of();
}
if (this.actual == null
|| this.expected == null) {
StringBuilder missing = new StringBuilder();
if (this.actual == null) {
missing.append(" actual");
}
if (this.expected == null) {
missing.append(" expected");
}
throw new IllegalStateException("Missing required properties:" + missing);
}
return new AutoValue_DiffResult(
this.actual,
this.expected,
this.singularFields,
this.repeatedFields,
this.unknownFields);
}
}
}