Repro:
import testbox.system.BaseSpec
component extends=BaseSpec {
function run() {
describe("Repro cases for exception-oriented bugs", () => {
it("returns useful in the exception message (fails)", () => {
var myDate = createObject("java", "java.sql.Date").valueOf("2011-03-24")
try {
isNumeric(myDate)
} catch (any e) {
expect(e.message).notToBeNull()
}
})
it("returns useful in the exception detail (fails)", () => {
var myDate = createObject("java", "java.sql.Date").valueOf("2011-03-24")
try {
isNumeric(myDate)
} catch (any e) {
expect(e.detail).notToBeNull()
expect(e.detail).notToBeEmpty()
}
})
it("is a control with a CFML exception (passes)", () => {
try {
throw(message="not empty", detail="not empty either")
} catch (any e) {
expect(e.message).notToBeNull()
expect(e.detail).notToBeNull()
expect(e.detail).notToBeEmpty()
}
})
})
}
}
I’ve indicated passing / failing. The failing ones fail on the last expectation.
This surfaced when I was trying to use a java.sql.Date
value that came back from a DB query in a TestBox expection, and it went splat. With no useful information as to why.