public void testRET() throws Exception { LegContainer<SimpleEntry> container = craken.defineLeg(SimpleEntry.class); container.newInstance("bleujin").put("name", "bleujin").put("age", 20).save(); container.newInstance(7756).put("name", "hero").put("age", 364).save(); SimpleEntry bleujin = container.findByKey("bleujin"); Debug.line(bleujin.field("age"), bleujin.fieldAsInt("age") + 1, bleujin.fieldAsString("name")); SimpleEntry f7756 = container.findByKey(7756); Debug.line(f7756.field("age"), f7756.fieldAsInt("age") + 1, f7756.fieldAsString("name")); }
public void testFindOne() throws Exception { LegContainer<SimpleEntry> container = craken.defineLeg(SimpleEntry.class); container.newInstance("bleujin").put("name", "bleujin").put("age", 20).save(); container.newInstance(7756).put("name", "hero").put("age", 364).save(); SimpleEntry found = container.findOneInMemory( new EntryFilter<SimpleEntry>() { public boolean filter(SimpleEntry node) { return node.fieldAsInt("age") > 100; } }); assertEquals(364, found.fieldAsInt("age")); }