- exceptionDuringTest || expectedExceptionDetail
- new InterruptedException() || 'interrupted'
- new ExecutionException() || 'aborted'
+ exceptionDuringTest || expectedExceptionDetail
+ new InterruptedException() || 'interrupted'
+ new ExecutionException() || 'aborted'
+ }
+
+ def 'Close a session' () {
+ given: 'a session in the session map'
+ objectUnderTest.sessionMap.putAll([testSessionId1:mockSession1])
+ when: 'the session manager closes session'
+ objectUnderTest.closeSession('testSessionId1', commit)
+ then: 'commit or rollback is called on the transaction as appropriate'
+ if (commit) {
+ 1 * mockTransaction1.commit()
+ } else {
+ 1 * mockTransaction1.rollback()
+ }
+ and: 'the correct session is closed'
+ 1 * mockSession1.close()
+ where:
+ commit << [SessionManager.WITH_COMMIT, SessionManager.WITH_ROLLBACK]