@@ -110,6 +110,7 @@ public void testRootConversationFailure() {
110
110
Conversation conversation = manager .beginConversation (false , JoinMode .ROOT );
111
111
assertNotNull (conversation );
112
112
assertFalse (conversation .isTemporary ());
113
+ assertFalse (conversation .isSwitched ());
113
114
assertSame (conversation , manager .getCurrentConversation ());
114
115
115
116
try {
@@ -167,6 +168,7 @@ public void testNestedConversationEndingFailure() {
167
168
168
169
Conversation nestedConversation = manager .beginConversation (false , JoinMode .NESTED );
169
170
assertNotNull (nestedConversation );
171
+ assertFalse (nestedConversation .isSwitched ());
170
172
assertNotSame (conversation , nestedConversation );
171
173
assertTrue (nestedConversation .isNested ());
172
174
assertTrue (((MutableConversation ) conversation ).isParent ());
@@ -202,6 +204,7 @@ public void testIsolatedConversation() {
202
204
203
205
Conversation nestedConversation = manager .beginConversation (false , JoinMode .ISOLATED );
204
206
assertNotNull (nestedConversation );
207
+ assertFalse (nestedConversation .isSwitched ());
205
208
assertSame (nestedConversation , manager .getCurrentConversation ());
206
209
assertNotSame (conversation , nestedConversation );
207
210
assertTrue (nestedConversation .isNested ());
@@ -226,6 +229,7 @@ public void testJoinedConversation() {
226
229
Conversation conversation = manager .beginConversation (false , JoinMode .ROOT );
227
230
assertNotNull (conversation );
228
231
assertFalse (conversation .isTemporary ());
232
+ assertFalse (conversation .isSwitched ());
229
233
assertSame (conversation , manager .getCurrentConversation ());
230
234
assertFalse (conversation .isNested ());
231
235
assertFalse (((MutableConversation ) conversation ).isParent ());
@@ -235,6 +239,7 @@ public void testJoinedConversation() {
235
239
236
240
Conversation joinedConversation = manager .beginConversation (false , JoinMode .JOINED );
237
241
assertNotNull (joinedConversation );
242
+ assertFalse (joinedConversation .isSwitched ());
238
243
assertSame (joinedConversation , manager .getCurrentConversation ());
239
244
assertSame (conversation , joinedConversation );
240
245
assertFalse (joinedConversation .isNested ());
@@ -259,6 +264,7 @@ public void testSwitchedConversation() {
259
264
Conversation conversation = manager .beginConversation (false , JoinMode .SWITCHED );
260
265
assertNotNull (conversation );
261
266
assertFalse (conversation .isTemporary ());
267
+ assertTrue (conversation .isSwitched ());
262
268
assertSame (conversation , manager .getCurrentConversation ());
263
269
assertFalse (conversation .isNested ());
264
270
assertFalse (((MutableConversation ) conversation ).isParent ());
@@ -268,6 +274,7 @@ public void testSwitchedConversation() {
268
274
269
275
Conversation switchedConversation = manager .beginConversation (false , JoinMode .SWITCHED );
270
276
assertNotNull (switchedConversation );
277
+ assertTrue (conversation .isSwitched ());
271
278
assertSame (switchedConversation , manager .getCurrentConversation ());
272
279
assertNotSame (conversation , switchedConversation );
273
280
assertFalse (switchedConversation .isNested ());
@@ -277,6 +284,7 @@ public void testSwitchedConversation() {
277
284
assertNotSame (bean , bean2 );
278
285
279
286
manager .switchConversation (conversation .getId ());
287
+ assertSame (conversation , manager .getCurrentConversation ());
280
288
assertSame (bean , context .getBean ("testBean" ));
281
289
282
290
manager .switchConversation (switchedConversation .getId ());
@@ -305,7 +313,30 @@ public void testSwitchedConversationEnding() {
305
313
manager .switchConversation (switchedConversation .getId ());
306
314
307
315
switchedConversation .end (ConversationEndingType .SUCCESS );
316
+ assertNull (manager .getCurrentConversation ());
308
317
conversation .end (ConversationEndingType .SUCCESS );
318
+ assertNull (manager .getCurrentConversation ());
319
+
320
+ assertTrue (conversation .isEnded ());
321
+ assertTrue (switchedConversation .isEnded ());
322
+ assertNull (resolver .getCurrentConversationId ());
323
+ assertNull (manager .getCurrentConversation ());
324
+ }
325
+
326
+ @ Test
327
+ public void testImplicitConversationEnding () {
328
+ Conversation conversation = manager .beginConversation (false , JoinMode .ROOT );
329
+ assertNotNull (conversation );
330
+ assertSame (conversation , manager .getCurrentConversation ());
331
+
332
+ Conversation switchedConversation = manager .beginConversation (false , JoinMode .SWITCHED );
333
+ assertNotNull (switchedConversation );
334
+ assertSame (switchedConversation , manager .getCurrentConversation ());
335
+ assertNotSame (conversation , switchedConversation );
336
+ assertTrue (conversation .isEnded ());
337
+
338
+ switchedConversation .end (ConversationEndingType .SUCCESS );
339
+ assertNull (manager .getCurrentConversation ());
309
340
310
341
assertTrue (conversation .isEnded ());
311
342
assertTrue (switchedConversation .isEnded ());
0 commit comments