use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class NumericStringMatchingRuleTestCase method testMatchingValues.
/**
* Tests the numeric string matching rule with a number of value pairs
* that should be considered matches.
*
* @param value1 The first value to compare.
* @param value2 The second value to compare.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(dataProvider = "testMatchingValues")
public void testMatchingValues(String value1, String value2) throws Exception {
ASN1OctetString value1OS = new ASN1OctetString(value1);
ASN1OctetString value2OS = new ASN1OctetString(value2);
NumericStringMatchingRule matchingRule = NumericStringMatchingRule.getInstance();
assertTrue(matchingRule.valuesMatch(value1OS, value2OS), value1 + ", " + value2);
}
use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class OctetStringMatchingRuleTestCase method testNormalizeSubstring.
/**
* Tests the {@code normalizeSubstring} method with the provided information.
*
* @param rawValue The raw value to be normalized.
* @param substringType The substring type to use when performing the
* normalization.
* @param normalizedValue The expected normalized representation of the
* provided value.
*/
@Test(dataProvider = "testNormalizeSubstringValues")
public void testNormalizeSubstring(String rawValue, byte substringType, String normalizedValue) {
ASN1OctetString rawOS = new ASN1OctetString(rawValue);
OctetStringMatchingRule matchingRule = OctetStringMatchingRule.getInstance();
ASN1OctetString gotOS = matchingRule.normalizeSubstring(rawOS, substringType);
assertEquals(gotOS.stringValue(), normalizedValue);
}
use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class OctetStringMatchingRuleTestCase method testMatchingValues.
/**
* Tests the octet string matching rule with a number of value pairs
* that should be considered matches.
*
* @param value1 The first value to compare.
* @param value2 The second value to compare.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(dataProvider = "testMatchingValues")
public void testMatchingValues(String value1, String value2) throws Exception {
ASN1OctetString value1OS = new ASN1OctetString(value1);
ASN1OctetString value2OS = new ASN1OctetString(value2);
OctetStringMatchingRule matchingRule = OctetStringMatchingRule.getInstance();
assertTrue(matchingRule.valuesMatch(value1OS, value2OS), value1 + ", " + value2);
}
use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class SimpleMatchingRuleTestCase method testCompareValuesNonMatching.
/**
* Tests the {@code compareValues} method with values that should not be
* considered matches.
*
* @param value1 The first value to compare.
* @param value2 The second value to compare.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(dataProvider = "testNonMatchingValues")
public void testCompareValuesNonMatching(String value1, String value2) throws Exception {
ASN1OctetString value1OS = new ASN1OctetString(value1);
ASN1OctetString value2OS = new ASN1OctetString(value2);
CaseIgnoreStringMatchingRule matchingRule = CaseIgnoreStringMatchingRule.getInstance();
assertFalse(matchingRule.compareValues(value1OS, value2OS) == 0);
}
use of com.mindbright.asn1.ASN1OctetString in project ldapsdk by pingidentity.
the class SimpleMatchingRuleTestCase method testMatchingValues.
/**
* Tests the {@code valuesMatch} method with a number of value pairs
* that should be considered matches.
*
* @param value1 The first value to compare.
* @param value2 The second value to compare.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(dataProvider = "testMatchingValues")
public void testMatchingValues(String value1, String value2) throws Exception {
ASN1OctetString value1OS = new ASN1OctetString(value1);
ASN1OctetString value2OS = new ASN1OctetString(value2);
CaseIgnoreStringMatchingRule matchingRule = CaseIgnoreStringMatchingRule.getInstance();
assertTrue(matchingRule.valuesMatch(value1OS, value2OS));
value2OS = new ASN1OctetString(value2 + 'x');
assertFalse(matchingRule.valuesMatch(value1OS, value2OS));
}
Aggregations