use of javax.security.cert.CertificateExpiredException in project j2objc by google.
the class CertificateExpiredExceptionTest method testCertificateExpiredException01.
/**
* Test for <code>CertificateExpiredException()</code> constructor
* Assertion: constructs CertificateExpiredException with no detail message
*/
public void testCertificateExpiredException01() {
CertificateExpiredException tE = new CertificateExpiredException();
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
}
use of javax.security.cert.CertificateExpiredException in project j2objc by google.
the class CertificateExpiredExceptionTest method testCertificateExpiredException03.
/**
* Test for <code>CertificateExpiredException(String)</code> constructor
* Assertion: constructs CertificateExpiredException when <code>msg</code>
* is null
*/
public void testCertificateExpiredException03() {
String msg = null;
CertificateExpiredException tE = new CertificateExpiredException(msg);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
}
use of javax.security.cert.CertificateExpiredException in project j2objc by google.
the class CertificateExpiredExceptionTest method testCertificateExpiredException02.
/**
* Test for <code>CertificateExpiredException(String)</code> constructor
* Assertion: constructs CertificateExpiredException with detail message
* msg. Parameter <code>msg</code> is not null.
*/
public void testCertificateExpiredException02() {
CertificateExpiredException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new CertificateExpiredException(msgs[i]);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
}
}
use of javax.security.cert.CertificateExpiredException in project j2objc by google.
the class X509CertificateTest method testCheckValidity1.
/**
* checkValidity() method testing.
* @throws CertificateNotYetValidException
* @throws CertificateExpiredException
* @throws java.security.cert.CertificateExpiredException
* @throws java.security.cert.CertificateNotYetValidException
*/
public void testCheckValidity1() throws CertificateExpiredException, CertificateNotYetValidException, java.security.cert.CertificateExpiredException, java.security.cert.CertificateNotYetValidException {
if (this.cert == null) {
// Test can not be applied.
return;
}
Date date = new Date();
Date nb_date = tbt_cert.getNotBefore();
Date na_date = tbt_cert.getNotAfter();
try {
tbt_cert.checkValidity();
assertFalse("CertificateExpiredException expected", date.compareTo(na_date) > 0);
assertFalse("CertificateNotYetValidException expected", date.compareTo(nb_date) < 0);
} catch (CertificateExpiredException e) {
assertTrue("Unexpected CertificateExpiredException was thrown", date.compareTo(na_date) > 0);
} catch (CertificateNotYetValidException e) {
assertTrue("Unexpected CertificateNotYetValidException was thrown", date.compareTo(nb_date) < 0);
}
try {
tbt_cert.checkValidity();
} catch (CertificateExpiredException e) {
// ok
}
try {
cert.checkValidity();
} catch (java.security.cert.CertificateExpiredException e) {
// ok
}
}
Aggregations