File tree Expand file tree Collapse file tree
bugsnag/src/test/java/com/bugsnag Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -510,6 +510,29 @@ public void close() {
510510 assertTrue (bugsnag .notify (new Throwable ()));
511511 }
512512
513+ @ Test
514+ public void testMultipleHandledIncrementWithSession () {
515+ bugsnag .startSession ();
516+ StubNotificationDelivery testDelivery = new StubNotificationDelivery ();
517+ bugsnag .setDelivery (testDelivery );
518+
519+ assertTrue (bugsnag .notify (new Throwable ()));
520+ assertTrue (bugsnag .notify (new Throwable ()));
521+ assertTrue (bugsnag .notify (new Throwable ()));
522+
523+ for (int i = 0 ; i < testDelivery .getNotifications ().size (); i ++) {
524+ Report report = testDelivery .getNotifications ().get (i ).getEvents ().get (0 );
525+
526+ Map <String , Object > session = report .getSession ();
527+ assertNotNull (session );
528+
529+ @ SuppressWarnings ("unchecked" )
530+ Map <String , Object > handledCounts = (Map <String , Object >) session .get ("events" );
531+ assertEquals (i + 1 , handledCounts .get ("handled" ));
532+ assertEquals (0 , handledCounts .get ("unhandled" ));
533+ }
534+ }
535+
513536 @ Test
514537 public void testSerialization () {
515538 ByteArrayOutputStream byteStream = new ByteArrayOutputStream ();
You can’t perform that action at this time.
0 commit comments