### Question:
StatusProto { @Nullable public static com.google.rpc.Status fromThrowable(Throwable t) { Throwable cause = checkNotNull(t, "t"); while (cause != null) { if (cause instanceof StatusException) { StatusException e = (StatusException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } else if (cause instanceof StatusRuntimeException) { StatusRuntimeException e = (StatusRuntimeException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } cause = cause.getCause(); } return null; } private  StatusProto(); static StatusRuntimeException toStatusRuntimeException(com.google.rpc.Status statusProto); static StatusRuntimeException toStatusRuntimeException(
      com.google.rpc.Status statusProto, Metadata metadata); static StatusException toStatusException(com.google.rpc.Status statusProto); static StatusException toStatusException(
      com.google.rpc.Status statusProto, Metadata metadata); @Nullable static com.google.rpc.Status fromThrowable(Throwable t); @Nullable static com.google.rpc.Status fromStatusAndTrailers(Status status, Metadata trailers);  }### Answer:
@Test public void fromThrowable_shouldReturnNullIfTrailersAreNull() { Status status = Status.fromCodeValue(0); assertNull(StatusProto.fromThrowable(status.asRuntimeException())); assertNull(StatusProto.fromThrowable(status.asException())); }
@Test public void fromThrowable_shouldReturnNullIfStatusDetailsKeyIsMissing() { Status status = Status.fromCodeValue(0); Metadata emptyMetadata = new Metadata(); assertNull(StatusProto.fromThrowable(status.asRuntimeException(emptyMetadata))); assertNull(StatusProto.fromThrowable(status.asException(emptyMetadata))); }
@Test public void fromThrowable_shouldReturnNullIfNoEmbeddedStatus() { Throwable nestedSe = new Throwable(new Throwable("no status found")); assertNull(StatusProto.fromThrowable(nestedSe)); }