### Question:
LdapTlsHandshakeException extends LdapException { @Override public String getMessage() { String message = super.getMessage(); message += ", reason: " + failCause.getReasonPhrase(); Throwable rootCause = failCause.getRootCause(); if ( rootCause != null && rootCause != this ) { message += ": " + rootCause.getMessage(); } return message; } LdapTlsHandshakeException( String message, Throwable cause ); LdapTlsHandshakeFailCause getFailCause(); @Override String getMessage();  }### Answer:
@Test public void testClassifyNull() { LdapTlsHandshakeException e = new LdapTlsHandshakeException( "msg", null ); assertThat( e.getMessage(), equalTo( "msg, reason: Unspecified" ) ); }
@Test public void testClassifyOther() { LdapTlsHandshakeException e = new LdapTlsHandshakeException( "msg", new IOException( "foo" ) ); assertThat( e.getMessage(), equalTo( "msg, reason: Unspecified: foo" ) ); }
@Test public void testClassifyCertificateExpiredException() { LdapTlsHandshakeException e = new LdapTlsHandshakeException( "msg", new CertificateExpiredException( "foo" ) ); assertThat( e.getMessage(), equalTo( "msg, reason: Certificate expired: foo" ) ); }
@Test public void testClassifyCertificateNotYetValidException() { LdapTlsHandshakeException e = new LdapTlsHandshakeException( "msg", new CertificateNotYetValidException( "foo" ) ); assertThat( e.getMessage(), equalTo( "msg, reason: Certificate not yet valid: foo" ) ); }
@Test public void testClassifyCertPathBuilderException() { LdapTlsHandshakeException e = new LdapTlsHandshakeException( "msg", new Exception( new CertPathBuilderException( "foo" ) ) ); assertThat( e.getMessage(), equalTo( "msg, reason: Failed to build certification path: foo" ) ); }
@Test public void testClassifyCertPathValidatorException() { LdapTlsHandshakeException e = new LdapTlsHandshakeException( "msg", new Exception( new Exception( new Exception( new Exception( new CertPathValidatorException( "foo", null, null, -1, BasicReason.ALGORITHM_CONSTRAINED ) ) ) ) ) ); assertThat( e.getMessage(), equalTo( "msg, reason: Failed to verify certification path: foo" ) ); }