28
28
public class Defect381_UpdateModifiedOnlyTest extends ActiveJDBCTest {
29
29
30
30
@ Test
31
- public void isModifiedWhenModified () {
31
+ public void shouldBeModifiedWhenModified () {
32
32
Programmer prg = Programmer .createIt ("first_name" , "John" );
33
33
the (prg ).shouldNotBe ("new" );
34
34
the (prg ).shouldNotBe ("modified" );
35
35
prg .set ("last_name" , "Doe" );
36
36
the (prg ).shouldBe ("modified" );
37
+ the (prg .getDirtyAttributes ()).shouldContain ("last_name" );
38
+ the (prg .getDirtyAttributes ().size ()).shouldBeEqual (1 );
39
+
37
40
prg .saveIt ();
38
41
the (prg ).shouldNotBe ("modified" );
42
+ the (prg .getDirtyAttributes ().size ()).shouldBeEqual (0 );
39
43
}
40
44
41
45
@ Test
42
- public void isModifiedAfterCreated () {
46
+ public void shouldBeModifiedAfterCreated () {
43
47
Programmer prg = Programmer .create ("first_name" , "John" );
44
48
the (prg ).shouldBe ("new" );
45
49
the (prg ).shouldBe ("modified" );
46
50
prg .set ("last_name" , "Doe" );
47
51
the (prg ).shouldBe ("modified" );
52
+ the (prg .getDirtyAttributes ()).shouldBeEqual (prg .getAttributes ().keySet ());
53
+
48
54
prg .saveIt ();
49
55
the (prg ).shouldNotBe ("modified" );
56
+ the (prg .getDirtyAttributes ().size ()).shouldBeEqual (0 );
50
57
}
51
58
52
59
@ Test
53
- public void isModifiedAfterFroMap () {
60
+ public void shouldBeModifiedAfterFromMap () {
54
61
Programmer prg = Programmer .createIt ("first_name" , "John" );
55
62
the (prg ).shouldNotBe ("new" );
56
63
the (prg ).shouldNotBe ("modified" );
@@ -64,7 +71,7 @@ public void isModifiedAfterFroMap() {
64
71
}
65
72
66
73
@ Test
67
- public void isModifiedAfterFind () {
74
+ public void shouldNotBeModifiedAfterFind () {
68
75
Programmer prg = Programmer .createIt ("first_name" , "John" , "last_name" , "Doe" );
69
76
the (prg ).shouldNotBe ("new" );
70
77
the (prg ).shouldNotBe ("modified" );
@@ -76,7 +83,12 @@ public void isModifiedAfterFind() {
76
83
the (prgFromDB .get ("last_name" )).shouldBeEqual ("Doe" );
77
84
78
85
prgFromDB .set ("first_name" , "Jane" );
86
+ prgFromDB .set ("last_name" , "Moe" );
79
87
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
+
80
92
prgFromDB .saveIt ();
81
93
the (prgFromDB ).shouldNotBe ("modified" );
82
94
@@ -86,7 +98,7 @@ public void isModifiedAfterFind() {
86
98
}
87
99
88
100
@ Test
89
- public void isModifiedAfterDeletaAndThaw () {
101
+ public void shouldBeModifiedAfterDeletaAndThaw () {
90
102
Programmer prg = Programmer .createIt ("first_name" , "John" , "last_name" , "Doe" );
91
103
the (prg ).shouldNotBe ("new" );
92
104
the (prg ).shouldNotBe ("modified" );
0 commit comments