JUnit 4; introduced GroovyJenkinsRule.
[FIXED JENKINS-19920] Using selfReference to mean “none” from nextBuild/previousBuild was just asking for trouble.
JENKINS-16194 and an analogous but opposite bug fixed more simply by introducing a separate NONE constant.
Also numberOnDisk did not get updated properly after a build was deleted, causing double loading of build records in some cases.