From 94e292e54fe5320cc5657f773d91a80ad6ac3c0f Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 10 Feb 2016 10:22:10 +0000
Subject: [PATCH] SchemaTestCase.java: Added tests for Schema.getAttributeType()
---
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java b/opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java
index 56a9e14..32e6a27 100644
--- a/opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java
+++ b/opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java
@@ -21,7 +21,7 @@
* CDDL HEADER END
*
*
- * Copyright 2014 ForgeRock AS.
+ * Copyright 2014-2016 ForgeRock AS.
*/
package org.forgerock.opendj.ldap.schema;
@@ -38,9 +38,7 @@
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
-/**
- * Tests the Schema class.
- */
+/** Tests the Schema class. */
@SuppressWarnings("javadoc")
public class SchemaTestCase extends AbstractSchemaTestCase {
@Test(description = "Unit test for OPENDJ-1477")
@@ -107,4 +105,20 @@
connection.close();
}
+ @Test
+ public void getAttributeTypeWithDifferentNamesReturnSame() throws Exception {
+ Schema schema = CoreSchema.getInstance();
+ AttributeType cnAttrType = schema.getAttributeType("cn");
+ assertThat(cnAttrType).isSameAs(schema.getAttributeType("commonname"));
+ assertThat(cnAttrType).isSameAs(schema.getAttributeType("commonName"));
+ assertThat(cnAttrType).isSameAs(schema.getAttributeType("CN"));
+ }
+
+ @Test
+ public void getAttributeTypeWithDifferentPlaceholderNames() throws Exception {
+ Schema schema = CoreSchema.getInstance().asNonStrictSchema();
+ AttributeType placeHolderAttrType = schema.getAttributeType("placeholder");
+ assertThat(placeHolderAttrType).isEqualTo(schema.getAttributeType("PLACEHOLDER"));
+ assertThat(placeHolderAttrType).isNotEqualTo(schema.getAttributeType("another_placeholder"));
+ }
}
--
Gitblit v1.10.0