| 1 21 package com.db4o.db4ounit.common.assorted; 22 23 import com.db4o.*; 24 import com.db4o.foundation.*; 25 26 import db4ounit.Assert; 27 import db4ounit.extensions.AbstractDb4oTestCase; 28 29 public class YapClassTestCase extends AbstractDb4oTestCase { 30 31 public static class SuperClazz { 32 public int _id; 33 public String _name; 34 } 35 36 public static class SubClazz extends SuperClazz { 37 public int _age; 38 } 39 40 protected void store() throws Exception { 41 store(new SubClazz()); 42 } 43 44 public void testFieldIterator() { 45 Collection4 expectedNames=new Collection4(new ArrayIterator4(new String []{"_id","_name","_age"})); 46 YapClass clazz=stream().getYapClass(reflector().forClass(SubClazz.class)); 47 Iterator4 fieldIter=clazz.fields(); 48 while(fieldIter.moveNext()) { 49 YapField curField=(YapField)fieldIter.current(); 50 Assert.isNotNull(expectedNames.remove(curField.getName())); 51 } 52 Assert.isTrue(expectedNames.isEmpty()); 53 } 54 } 55 | Popular Tags |