Skip to content

Commit 3882731

Browse files
committed
#381: Changed test method names, added some ditry attribute list tests.
1 parent 38c697c commit 3882731

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

activejdbc/src/test/java/org/javalite/activejdbc/Defect381_UpdateModifiedOnlyTest.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,36 @@
2828
public class Defect381_UpdateModifiedOnlyTest extends ActiveJDBCTest {
2929

3030
@Test
31-
public void isModifiedWhenModified() {
31+
public void shouldBeModifiedWhenModified() {
3232
Programmer prg = Programmer.createIt("first_name", "John");
3333
the(prg).shouldNotBe("new");
3434
the(prg).shouldNotBe("modified");
3535
prg.set("last_name", "Doe");
3636
the(prg).shouldBe("modified");
37+
the(prg.getDirtyAttributes()).shouldContain("last_name");
38+
the(prg.getDirtyAttributes().size()).shouldBeEqual(1);
39+
3740
prg.saveIt();
3841
the(prg).shouldNotBe("modified");
42+
the(prg.getDirtyAttributes().size()).shouldBeEqual(0);
3943
}
4044

4145
@Test
42-
public void isModifiedAfterCreated() {
46+
public void shouldBeModifiedAfterCreated() {
4347
Programmer prg = Programmer.create("first_name", "John");
4448
the(prg).shouldBe("new");
4549
the(prg).shouldBe("modified");
4650
prg.set("last_name", "Doe");
4751
the(prg).shouldBe("modified");
52+
the(prg.getDirtyAttributes()).shouldBeEqual(prg.getAttributes().keySet());
53+
4854
prg.saveIt();
4955
the(prg).shouldNotBe("modified");
56+
the(prg.getDirtyAttributes().size()).shouldBeEqual(0);
5057
}
5158

5259
@Test
53-
public void isModifiedAfterFroMap() {
60+
public void shouldBeModifiedAfterFromMap() {
5461
Programmer prg = Programmer.createIt("first_name", "John");
5562
the(prg).shouldNotBe("new");
5663
the(prg).shouldNotBe("modified");
@@ -64,7 +71,7 @@ public void isModifiedAfterFroMap() {
6471
}
6572

6673
@Test
67-
public void isModifiedAfterFind() {
74+
public void shouldNotBeModifiedAfterFind() {
6875
Programmer prg = Programmer.createIt("first_name", "John", "last_name", "Doe");
6976
the(prg).shouldNotBe("new");
7077
the(prg).shouldNotBe("modified");
@@ -76,7 +83,12 @@ public void isModifiedAfterFind() {
7683
the(prgFromDB.get("last_name")).shouldBeEqual("Doe");
7784

7885
prgFromDB.set("first_name", "Jane");
86+
prgFromDB.set("last_name", "Moe");
7987
the(prgFromDB).shouldBe("modified");
88+
the(prgFromDB.getDirtyAttributes()).shouldContain("first_name");
89+
the(prgFromDB.getDirtyAttributes()).shouldContain("last_name");
90+
the(prgFromDB.getDirtyAttributes().size()).shouldBeEqual(2);
91+
8092
prgFromDB.saveIt();
8193
the(prgFromDB).shouldNotBe("modified");
8294

@@ -86,7 +98,7 @@ public void isModifiedAfterFind() {
8698
}
8799

88100
@Test
89-
public void isModifiedAfterDeletaAndThaw() {
101+
public void shouldBeModifiedAfterDeletaAndThaw() {
90102
Programmer prg = Programmer.createIt("first_name", "John", "last_name", "Doe");
91103
the(prg).shouldNotBe("new");
92104
the(prg).shouldNotBe("modified");

0 commit comments

Comments
 (0)