public void testGetStoredFields() { assertStoredField(Item.class, FIELD_NAME, ITEM_NAME, String.class, true, false); assertStoredField(ItemParent.class, "_array", null, String.class, false, true); StoredClass itemStoredClass = itemStoredClass(); StoredField storedField = itemStoredClass.storedField(FIELD_NAME, null); StoredField sameStoredField = itemStoredClass.getStoredFields()[0]; StoredField otherStoredField = storedClass(ItemParent.class).getStoredFields()[0]; Assert.equalsAndHashcode(storedField, sameStoredField, otherStoredField); Assert.isNull(itemStoredClass.storedField("", null)); }
protected void assertNullItem(Object obj) throws Exception { ReflectClass claxx = reflector().forObject(obj); ReflectField[] fields = claxx.getDeclaredFields(); for (int i = 0; i < fields.length; ++i) { ReflectField field = fields[i]; if (field.isStatic() || field.isTransient()) { continue; } ReflectClass type = field.getFieldType(); if (container().classMetadataForReflectClass(type).isValueType()) { continue; } Object value = field.get(obj); Assert.isNull(value); } }
public void testUnknownStoredClass() { Assert.isNull(storedClass(this.getClass())); }