@@ -382,6 +382,7 @@ public void testExposureCorrection() {
382382
383383 //region testLocation
384384
385+ @ SuppressWarnings ("ConstantConditions" )
385386 @ Test
386387 public void testSetLocation () {
387388 cameraView .setLocation (50d , -50d );
@@ -554,6 +555,7 @@ public void testVideoQuality() {
554555
555556 //region Lists of listeners and processors
556557
558+ @ SuppressWarnings ("UseBulkOperation" )
557559 @ Test
558560 public void testCameraListenerList () {
559561 assertTrue (cameraView .mListeners .isEmpty ());
@@ -571,8 +573,17 @@ public void testCameraListenerList() {
571573
572574 cameraView .clearCameraListeners ();
573575 assertTrue (cameraView .mListeners .isEmpty ());
576+
577+ // Ensure this does not throw a ConcurrentModificationException
578+ cameraView .addCameraListener (new CameraListener () {});
579+ cameraView .addCameraListener (new CameraListener () {});
580+ cameraView .addCameraListener (new CameraListener () {});
581+ for (CameraListener test : cameraView .mListeners ) {
582+ cameraView .mListeners .remove (test );
583+ }
574584 }
575585
586+ @ SuppressWarnings ({"NullableProblems" , "UseBulkOperation" })
576587 @ Test
577588 public void testFrameProcessorsList () {
578589 assertTrue (cameraView .mFrameProcessors .isEmpty ());
@@ -592,6 +603,14 @@ public void process(@NonNull Frame frame) {}
592603
593604 cameraView .clearFrameProcessors ();
594605 assertTrue (cameraView .mFrameProcessors .isEmpty ());
606+
607+ // Ensure this does not throw a ConcurrentModificationException
608+ cameraView .addFrameProcessor (new FrameProcessor () { public void process (Frame f ) {} });
609+ cameraView .addFrameProcessor (new FrameProcessor () { public void process (Frame f ) {} });
610+ cameraView .addFrameProcessor (new FrameProcessor () { public void process (Frame f ) {} });
611+ for (FrameProcessor test : cameraView .mFrameProcessors ) {
612+ cameraView .mFrameProcessors .remove (test );
613+ }
595614 }
596615
597616 //endregion
0 commit comments