@@ -192,46 +192,43 @@ else if (type.type() == Types.Thumbnail && type.card() == Cardinality.Alt)
192192 Field [] fields = schemaClass .getFields ();
193193 for (Field field : fields )
194194 {
195- if (field .isAnnotationPresent (PropertyType .class ))
195+ if (field .isAnnotationPresent (PropertyType .class ) && ! field . get ( schema ). equals ( property ) )
196196 {
197- if (!field .get (schema ).equals (property ))
197+ PropertyType pt = field .getAnnotation (PropertyType .class );
198+ if (pt .type () == Types .LangAlt )
198199 {
199- PropertyType pt = field .getAnnotation (PropertyType .class );
200- if (pt .type () == Types .LangAlt )
201- {
202- // do not check method existence
203- }
204- else if (pt .type () == Types .Thumbnail && pt .card () == Cardinality .Alt )
205- {
206- // do not check method existence
207- }
208- else if (pt .type () == Types .ResourceRef )
209- {
210- // do not check method existence
211- }
212- else if (pt .type () == Types .Version && pt .card () == Cardinality .Seq )
213- {
214- // do not check method existence
215- }
216- else
200+ // do not check method existence
201+ }
202+ else if (pt .type () == Types .Thumbnail && pt .card () == Cardinality .Alt )
203+ {
204+ // do not check method existence
205+ }
206+ else if (pt .type () == Types .ResourceRef )
207+ {
208+ // do not check method existence
209+ }
210+ else if (pt .type () == Types .Version && pt .card () == Cardinality .Seq )
211+ {
212+ // do not check method existence
213+ }
214+ else
215+ {
216+ // type test
217+ PropertyType spt = retrievePropertyType (field .get (schema ).toString ());
218+ String getNameProperty = "get" + prepareName (field .get (schema ).toString (), spt ) + "Property" ;
219+ Method getMethod = schemaClass .getMethod (getNameProperty );
220+ assertNull (getMethod .invoke (schema ), getNameProperty + " should return null when testing " + property );
221+ // value test
222+ String getNameValue = "get" + prepareName (field .get (schema ).toString (), spt );
223+ if (schemaClass == XMPMediaManagementSchema .class && "getHistory" .equals (getNameValue ))
217224 {
218- // type test
219- PropertyType spt = retrievePropertyType (field .get (schema ).toString ());
220- String getNameProperty = "get" + prepareName (field .get (schema ).toString (), spt ) + "Property" ;
221- Method getMethod = schemaClass .getMethod (getNameProperty );
222- assertNull (getMethod .invoke (schema ), getNameProperty + " should return null when testing " + property );
223- // value test
224- String getNameValue = "get" + prepareName (field .get (schema ).toString (), spt );
225- if (schemaClass == XMPMediaManagementSchema .class && "getHistory" .equals (getNameValue ))
226- {
227- // PDFBOX-6111: getHistory() has been removed because it doesn't work
228- // because it's an array of a structured type and not of a text value
229- continue ;
230- }
231- getMethod = schemaClass .getMethod (getNameValue );
232- assertNotNull (getMethod , getNameValue + " method should exist" );
233- assertNull (getMethod .invoke (schema ), getNameValue + " should return null when testing " + property );
225+ // PDFBOX-6111: getHistory() has been removed because it doesn't work
226+ // because it's an array of a structured type and not of a text value
227+ continue ;
234228 }
229+ getMethod = schemaClass .getMethod (getNameValue );
230+ assertNotNull (getMethod , getNameValue + " method should exist" );
231+ assertNull (getMethod .invoke (schema ), getNameValue + " should return null when testing " + property );
235232 }
236233 }
237234 }
0 commit comments