diff --git a/core/modules/migrate/tests/src/Kernel/HighWaterNotJoinableTest.php b/core/modules/migrate/tests/src/Kernel/HighWaterNotJoinableTest.php
index d0bc155..b8d2a24 100644
--- a/core/modules/migrate/tests/src/Kernel/HighWaterNotJoinableTest.php
+++ b/core/modules/migrate/tests/src/Kernel/HighWaterNotJoinableTest.php
@@ -55,7 +55,9 @@ public function providerSource() {
       ],
     ];
 
-    $tests[0]['expected_count'] = NULL;
+    // The expected count is the count returned by the query before the query
+    // is modified by SqlBase::initializeIterator().
+    $tests[0]['expected_count'] = 3;
     $tests[0]['configuration'] = [
       'high_water_property' => [
         'name' => 'changed',
diff --git a/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php b/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
index 8a99cad..00f07a9 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
@@ -160,8 +160,8 @@ public function testSource(array $source_data, array $expected_data, $expected_c
     // If an expected count was given, assert it only if the plugin is
     // countable.
     if (is_numeric($expected_count)) {
-      $this->assertInstanceOf('\Iterator', $plugin);
-      $this->assertSame($expected_count, iterator_count($plugin));
+      $this->assertInstanceOf('\Countable', $plugin);
+      $this->assertCount($expected_count, $plugin);
     }
 
     $i = 0;
@@ -185,6 +185,11 @@ public function testSource(array $source_data, array $expected_data, $expected_c
         }
       }
     }
+    // False positives occur if the foreach is not entered. So, confirm the
+    // foreach loop was entered if the expected count is greater than 0.
+    if ($expected_count > 0) {
+      $this->assertGreaterThan(0, $i);
+    }
   }
 
 }
