use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class DistinguishedNameMatchingRuleTestCase method testNormalizeInvalid.
/**
* Tests to ensure that the {@code normalize} method throws an exception when
* given values that aren't valid DNs.
*
* @param invalidDN A string that cannot be parsed as a valid DN.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(dataProvider = "testInvalidDNs", expectedExceptions = { LDAPException.class })
public void testNormalizeInvalid(String invalidDN) throws Exception {
DistinguishedNameMatchingRule mr = DistinguishedNameMatchingRule.getInstance();
mr.normalize(new ASN1OctetString(invalidDN));
}
use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class DistinguishedNameMatchingRuleTestCase method testNormalizeSubstring.
/**
* Tests to ensure that the {@code normalizeSubstring} method always throws an
* exception.
*
* @param dn1 The first DN.
* @param dn2 The second DN.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(dataProvider = "testValidDNs", expectedExceptions = { LDAPException.class })
public void testNormalizeSubstring(String dn1, String dn2) throws Exception {
DistinguishedNameMatchingRule mr = DistinguishedNameMatchingRule.getInstance();
mr.normalizeSubstring(new ASN1OctetString(dn1), (byte) 0x80);
}
use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class DistinguishedNameMatchingRuleTestCase method testValuesMatchInvalid.
/**
* Tests the {@code valuesMatch} method with an invalid DN.
*
* @param invalidDN The invalid DN to compare.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(dataProvider = "testInvalidDNs")
public void testValuesMatchInvalid(String invalidDN) throws Exception {
DistinguishedNameMatchingRule mr = DistinguishedNameMatchingRule.getInstance();
try {
mr.valuesMatch(new ASN1OctetString(invalidDN), new ASN1OctetString("dc=example,dc=com"));
fail("Expected an exception with an invalid first DN.");
} catch (LDAPException le) {
// This was expected.
}
try {
mr.valuesMatch(new ASN1OctetString("dc=example,dc=com"), new ASN1OctetString(invalidDN));
fail("Expected an exception with an invalid second DN.");
} catch (LDAPException le) {
// This was expected.
}
}
use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class GeneralizedTimeMatchingRuleTestCase method testNormalizeInvalid.
/**
* Tests to ensure that the {@code normalize} method throws an exception when
* given values that aren't valid timestamps.
*
* @param invalidValue A string that cannot be parsed as a valid timestamp.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(dataProvider = "testInvalidValues", expectedExceptions = { LDAPException.class })
public void testNormalizeInvalid(String invalidValue) throws Exception {
GeneralizedTimeMatchingRule mr = GeneralizedTimeMatchingRule.getInstance();
mr.normalize(new ASN1OctetString(invalidValue));
}
use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class GeneralizedTimeMatchingRuleTestCase method testValuesMatchInvalid.
/**
* Tests the {@code valuesMatch} method with an invalid value.
*
* @param invalidValue The invalid value to compare.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(dataProvider = "testInvalidValues")
public void testValuesMatchInvalid(String invalidValue) throws Exception {
GeneralizedTimeMatchingRule mr = GeneralizedTimeMatchingRule.getInstance();
try {
mr.valuesMatch(new ASN1OctetString(invalidValue), new ASN1OctetString("20080101000000Z"));
fail("Expected an exception with an invalid first value.");
} catch (LDAPException le) {
// This was expected.
}
try {
mr.valuesMatch(new ASN1OctetString("20080101000000Z"), new ASN1OctetString(invalidValue));
fail("Expected an exception with an invalid second value.");
} catch (LDAPException le) {
// This was expected.
}
}
Aggregations