diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
index 848c458a75..4bdf89da3e 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
@@ -428,13 +428,64 @@ public function testProcessWithDifferentArgumentsOrderAndDefaultValue() {
     $this->assertEquals($expected, array_values($method_calls[0][1]));
   }
 
+  /**
+   * Tests consumer which doesn't exist.
+   */
+  public function testProcessWithNotExistingClass() {
+    $container = $this->buildContainer();
+
+    $container
+      ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer')
+      ->addTag('service_collector', []);
+
+    $container
+      ->register('handler1', __NAMESPACE__ . '\NotExistingHandler')
+      ->addTag('consumer_id', [
+        'priority' => 0,
+        'extra1' => 'extra1',
+        'extra3' => 'extra3'
+      ]);
+    $handler_pass = new TaggedHandlersPass();
+    $handler_pass->process($container);
+
+    $this->setExpectedException(\Exception::class, "Service 'handler1' for consumer 'consumer_id' does have a not existing class " . __NAMESPACE__ . '\NotExistingHandler');
+  }
+
+  /**
+   * Tests consumer with missing interface implementation.
+   */
+  public function testProcessWithMissingInterface() {
+    $container = $this->buildContainer();
+
+    $container
+      ->register('consumer_id', __NAMESPACE__ . '\ValidConsumer')
+      ->addTag('service_collector', [
+        'call' => 'addHandler2'
+      ]);
+
+    $container
+      ->register('handler1', __NAMESPACE__ . '\ValidHandler')
+      ->addTag('consumer_id', [
+        'priority' => 0,
+        'extra1' => 'extra1',
+        'extra3' => 'extra3'
+      ]);
+    $handler_pass = new TaggedHandlersPass();
+    $this->setExpectedException(\Exception::class, "Service 'handler1' for consumer 'consumer_id' does not implement Drupal\Tests\Core\DependencyInjection\Compiler\Handler2Interface.");
+    $handler_pass->process($container);
+  }
+
 }
 
 interface HandlerInterface {
 }
+interface Handler2Interface {
+}
 class ValidConsumer {
   public function addHandler(HandlerInterface $instance, $priority = 0) {
   }
+  public function addHandler2(Handler2Interface $instance, $priority = 0) {
+  }
   public function addNoPriority(HandlerInterface $instance) {
   }
   public function addWithId(HandlerInterface $instance, $id, $priority = 0) {
