I could not find any source for the purpose of the Boolean return
value of method Mapper.save .
With ScalaTest I wrote a JUnit-like test case for the return value,
but it found only situations in which save returns true. I did not
succeed to make it return false.
I looked into MetaMapper.save, but did not understand, how the ret
values there are computed.
If someone please could give me a hint about the meaning, I would
amend the appropriate Wiki page.
/**Tests the Boolean return value of the Mapper method save.*/
@Test def mapperSave {
val testFac: Faculty =
Faculty.create.name("TestFaculty1").kuerzel("Test FB 1");
{
val saved = testFac.save()
assert(saved === true, "Faculty newly inserted into database")
}
{
val saved = testFac.save()
assert(saved === true, "Faculty was not modified")
}
{
val saved = testFac.kuerzel("Test FB 1").save()
assert(saved === true, "Faculty was identically modified")
}
{
val saved = testFac.kuerzel("Test FB I").save()
assert(saved === true, "Faculty was modified, thus updated in
database")
}
{
//Modify ID after saving:
intercept[Exception]{testFac.id(99999).save()}
}
}