@@ -89,8 +89,8 @@ public void testFieldIsObjectType() throws Exception{
89
89
* it requires two fields.
90
90
*/
91
91
@ Test
92
- public void testFieldIsArrayField () throws Exception {
93
- String arrayFieldName = "someArray " ;
92
+ public void testFieldIsSimpleArrayField () throws Exception {
93
+ String arrayFieldName = "someSimpleArray " ;
94
94
String arrayCountFieldName = LightblueUtil .createArrayCountFieldName (arrayFieldName );
95
95
Entry entry = buildEntry (
96
96
arrayCountFieldName ,
@@ -110,6 +110,24 @@ public void testFieldIsArrayFieldWithoutMatchArray() throws Exception{
110
110
assertNotNull (entry .getAttribute (arrayCountFieldName ));
111
111
}
112
112
113
+ /**
114
+ * This test is kind of hacky as it requires json injection in order to make it work because
115
+ * it requires two fields.
116
+ * ObjectFields are not currently supported in LDAP, an exception should be thrown indicating as such.
117
+ */
118
+ @ Test (expected = UnsupportedOperationException .class )
119
+ public void testObjectArrayField_ThrowsException () throws Exception {
120
+ String arrayFieldName = "someObjectArray" ;
121
+ String arrayCountFieldName = LightblueUtil .createArrayCountFieldName (arrayFieldName );
122
+ Entry entry = buildEntry (
123
+ arrayCountFieldName ,
124
+ "{\" type\" : \" integer\" }, " + quote (arrayFieldName ) + ": {\" type\" : \" array\" , \" items\" : {\" type\" : \" object\" ,\" fields\" : {\" someField\" : {\" type\" : \" string\" }}}}" ,
125
+ "1," + quote (arrayFieldName ) + ":[{\" someField\" :\" hello\" }]" );
126
+
127
+ assertNotNull (entry );
128
+ assertNull (entry .getAttribute (arrayFieldName ));
129
+ }
130
+
113
131
@ Test (expected = IllegalArgumentException .class )
114
132
public void testFieldIsDN () throws Exception {
115
133
buildEntry (LdapConstant .ATTRIBUTE_DN , "{\" type\" : \" string\" }" , quote ("uid=someuid,dc=example,dc=com" ));
0 commit comments