LifeCycle.reset();
}
@Test
public void testLifeCycle() {
LifeCycle lc = new LifeCycle();
lc.foo = "bar";
lc.bar = "xx";
lc.save();
t("bar", OnAdd.class, 1);
t("bar", Added.class, 1);
t("bar2", OnAdd.class, 1);
t("bar", Object.class, 2);
lc.bar = "yy";
lc.save();
t("bar", OnAdd.class, 1);
t("bar", OnUpdate.class, 1);
t("bar", Updated.class, 1);
t("bar2", OnUpdate.class, 1);
t("bar", Object.class, 4);
lc.bar = "zz";
lc.save();
t("bar", OnAdd.class, 1);
t("bar", OnUpdate.class, 2);
t("bar", Updated.class, 2);
t("bar2", OnUpdate.class, 2);
t("bar", Object.class, 6);
lc = LifeCycle.q("foo", "bar").get();
t("bar", OnAdd.class, 1);
t("bar", OnUpdate.class, 2);
t("bar", Updated.class, 2);
t("bar2", OnUpdate.class, 2);
t("foo", OnLoad.class, 1);
t("bar", Loaded.class, 1);
t("bar", Object.class, 7);
t("foo", Object.class, 1);
lc.delete();
t("bar", OnAdd.class, 1);
t("bar", OnUpdate.class, 2);
t("bar", Updated.class, 2);
t("bar2", OnUpdate.class, 2);
t("bar", OnDelete.class, 1);