-
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3519 from FOCONIS/no-codechange-test-cleanup
No productive code change: cleanup basic test data
- Loading branch information
Showing
4 changed files
with
42 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,24 +52,30 @@ public void testBeanCacheWithLazyLoading() { | |
|
||
DB.save(contact); | ||
|
||
// Only get two properties, so we have to lazy-load later | ||
final Contact contactDb = DB.find(Contact.class).where().eq("email", "[email protected]").select("email,lastName").findOne(); | ||
assertThat(contactDb).isNotNull(); | ||
LoggedSql.start(); | ||
contactDb.setLastName("Buttonnnn"); | ||
List<String> sql = LoggedSql.collect(); | ||
assertThat(sql).isEmpty(); // setter did not trigger lazy load | ||
try { | ||
|
||
// trigger lazy load | ||
assertThat(contactDb.getPhone()).isEqualTo("1234567890"); | ||
sql = LoggedSql.collect(); | ||
assertThat(sql).isNotEmpty(); // Lazy-load took place | ||
// Only get two properties, so we have to lazy-load later | ||
final Contact contactDb = DB.find(Contact.class).where().eq("email", "[email protected]").select("email,lastName").findOne(); | ||
assertThat(contactDb).isNotNull(); | ||
LoggedSql.start(); | ||
contactDb.setLastName("Buttonnnn"); | ||
List<String> sql = LoggedSql.collect(); | ||
assertThat(sql).isEmpty(); // setter did not trigger lazy load | ||
|
||
final Contact contactDb2 = DB.find(Contact.class).where().eq("email", "[email protected]").select("email,lastName").findOne(); | ||
sql = LoggedSql.stop(); | ||
assertThat(sql).isEmpty(); // We expect that the bean was loaded from cache | ||
assertThat(contactDb2).isNotNull(); | ||
assertThat(contactDb2.getLastName()).isEqualTo("Button"); | ||
// trigger lazy load | ||
assertThat(contactDb.getPhone()).isEqualTo("1234567890"); | ||
sql = LoggedSql.collect(); | ||
assertThat(sql).isNotEmpty(); // Lazy-load took place | ||
|
||
final Contact contactDb2 = DB.find(Contact.class).where().eq("email", "[email protected]").select("email,lastName").findOne(); | ||
sql = LoggedSql.stop(); | ||
assertThat(sql).isEmpty(); // We expect that the bean was loaded from cache | ||
assertThat(contactDb2).isNotNull(); | ||
assertThat(contactDb2.getLastName()).isEqualTo("Button"); | ||
} finally { | ||
DB.delete(customer); | ||
DB.find(Contact.class).where().eq("email", "[email protected]").delete(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters