Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Sep 16, 2013
1 parent 270b28e commit 096ca2f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/org/nutz/dao/test/normal/UpdateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.FieldFilter;
import org.nutz.dao.test.DaoCase;
import org.nutz.dao.test.meta.BeanWithDefault;
import org.nutz.dao.test.meta.Fighter;
import org.nutz.dao.test.meta.Pet;
import org.nutz.dao.test.meta.Platoon;
import org.nutz.lang.Lang;
import org.nutz.trans.Atom;

public class UpdateTest extends DaoCase {

Expand Down Expand Up @@ -159,6 +161,23 @@ public void test_updateIgnoreNull() {
dao.update(p);
p = dao.fetch(Platoon.class, "sF");
assertNull(p.getLeaderName());

p.setLeaderName("ABC");
dao.update(p);
p = dao.fetch(Platoon.class, "sF");
assertEquals("ABC", p.getLeaderName());

FieldFilter.create(Platoon.class, true).run(new Atom() {

public void run() {
System.out.println(FieldFilter.get(Platoon.class));
Platoon p = dao.fetch(Platoon.class, "sF");
p.setLeaderName(null);
dao.update(p);
}
});
p = dao.fetch(Platoon.class, "sF");
assertEquals("ABC", p.getLeaderName());
}

@Test
Expand Down Expand Up @@ -195,4 +214,9 @@ public void test_update_self_plus() {
dao.update(Pet.class, Chain.makeSpecial("age", "+1"), null);
assertEquals(pet.getAge() + 1, dao.fetch(Pet.class, pet.getId()).getAge());
}

@Test
public void testZZ() {

}
}

0 comments on commit 096ca2f

Please sign in to comment.