DeviceRegistration extends JsonSerializable implements Serializable { @Override public String toString() { X509Certificate certificate = null; try { certificate = getAttestationCertificate(); } catch (CertificateException e) { } catch (U2fBadInputException e) { } return MoreObjects.toStringHelper(this) .omitNullValues() .add("Key handle", keyHandle) .add("Public key", publicKey) .add("Counter", counter) .add("Attestation certificate", certificate) .toString(); } @JsonCreator  DeviceRegistration(@JsonProperty("keyHandle") String keyHandle, @JsonProperty("publicKey") String publicKey, @JsonProperty("attestationCert") String attestationCert, @JsonProperty("counter") long counter, @JsonProperty("compromised") boolean compromised);  DeviceRegistration(String keyHandle, String publicKey, X509Certificate attestationCert, long counter); String getKeyHandle(); String getPublicKey(); @JsonIgnore X509Certificate getAttestationCertificate(); long getCounter(); boolean isCompromised(); void markCompromised(); @Override String toString(); static DeviceRegistration fromJson(String json); @Override String toJson(); String toJsonWithAttestationCert(); void checkAndUpdateCounter(long clientCounter); static final long INITIAL_COUNTER_VALUE; }
@Test public void toStringDoesNotReturnNull() { assertNotNull(new DeviceRegistration("A", "B", null, 0, false).toString()); }