Skip to content

Commit 0d7db2b

Browse files
author
Igor Polevoy
committed
#405 Implement minimal support for composite primary keys
1 parent e93ab57 commit 0d7db2b

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ public class CompositePkTest extends ActiveJDBCTest {
1414
@Test
1515
public void shouldInsertAndUpdate(){
1616

17-
Developer comp1 = new Developer();
18-
comp1.set("first_name", "John", "last_name", "Smith", "email", "smithy@spam.org", "address", "bla");
19-
comp1.saveIt();
17+
Developer dev1 = new Developer();
18+
dev1.set("first_name", "John", "last_name", "Smith", "email", "smithy@spam.org", "address", "bla");
19+
dev1.saveIt();
2020

21-
Developer comp2 = new Developer();
22-
comp2.set("first_name", "John", "last_name", "Smith2", "email", "smithy@spam.org", "address", "blabla");
23-
comp2.saveIt();
21+
Developer dev2 = new Developer();
22+
dev2.set("first_name", "John", "last_name", "Smith2", "email", "smithy@spam.org", "address", "blabla");
23+
dev2.saveIt();
2424

2525
the(Developer.count()).shouldBeEqual(2);
2626
the(Developer.findByCompositeKeys("John", "Smith", "smithy@spam.org").get("address")).shouldBeEqual("bla");
@@ -69,27 +69,27 @@ public void shouldReturnNullWithWrongPKs() {
6969
@Test
7070
public void shouldDeleteByPK() {
7171
Developer.createIt("first_name", "Johnny", "last_name", "Cash", "email", "j.cash@spam.org", "address", "inserted");
72-
Developer comp = Developer.findByCompositeKeys("Johnny", "Cash", "j.cash@spam.org");
73-
the(comp).shouldNotBeNull();
72+
Developer dev = Developer.findByCompositeKeys("Johnny", "Cash", "j.cash@spam.org");
73+
the(dev).shouldNotBeNull();
7474
the(Developer.count()).shouldBeEqual(1);
75-
comp.delete();
75+
dev.delete();
7676
the(Developer.count()).shouldBeEqual(0);
77-
the(comp.isFrozen()).shouldBeTrue();
77+
the(dev.isFrozen()).shouldBeTrue();
7878
}
7979

8080
@Test
8181
public void shouldBeNew() {
8282

83-
Developer comp = new Developer();
84-
comp.set("first_name", "Johnny", "last_name", "Cash", "email", "j.cash@spam.org", "address", "inserted");
85-
the(comp.isNew()).shouldBeTrue();
83+
Developer dev = new Developer();
84+
dev.set("first_name", "Johnny", "last_name", "Cash", "email", "j.cash@spam.org", "address", "inserted");
85+
the(dev.isNew()).shouldBeTrue();
8686

8787
Developer.createIt("first_name", "Johnny", "last_name", "Cash", "email", "j.cash@spam.org", "address", "inserted");
88-
comp = Developer.findByCompositeKeys("Johnny", "Cash", "j.cash@spam.org");
89-
the(comp).shouldNotBeNull();
90-
the(comp.isNew()).shouldBeFalse();
88+
dev = Developer.findByCompositeKeys("Johnny", "Cash", "j.cash@spam.org");
89+
the(dev).shouldNotBeNull();
90+
the(dev.isNew()).shouldBeFalse();
9191

92-
comp = Developer.createIt("first_name", "Johnny", "last_name", "Cash2", "email", "j.cash@spam.org", "address", "inserted");
93-
the(comp.isNew()).shouldBeFalse();
92+
dev = Developer.createIt("first_name", "Johnny", "last_name", "Cash2", "email", "j.cash@spam.org", "address", "inserted");
93+
the(dev.isNew()).shouldBeFalse();
9494
}
9595
}

0 commit comments

Comments
 (0)