diff --git a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
index aaa56d0993e8ebd32291a53f176528be497298af..3f489759d315159db9e1f5eb0eb8752faab55e74 100644
--- a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
+++ b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
@@ -107,7 +107,7 @@ public function mainContentFallback() {
    * @return string
    *   Empty string, we just test the setting of messages.
    */
-  public function drupalSetMessageTest() {
+  public function messengerServiceTest() {
     // Set two messages.
     $this->messenger->addStatus('First message (removed).');
     $this->messenger->addStatus($this->t('Second message with <em>markup!</em> (not removed).'));
diff --git a/core/modules/system/tests/modules/system_test/system_test.routing.yml b/core/modules/system/tests/modules/system_test/system_test.routing.yml
index b7cba071e16d33b80bf2f4e0ffe6524fc7c75a32..b47174faacfc377bd7e41f52c9c159e3d1fc18e0 100644
--- a/core/modules/system/tests/modules/system_test/system_test.routing.yml
+++ b/core/modules/system/tests/modules/system_test/system_test.routing.yml
@@ -13,11 +13,11 @@ system_test.main_content_handling:
   requirements:
     _access: 'TRUE'
 
-system_test.drupal_set_message:
-  path: '/system-test/drupal-set-message'
+system_test.messenger_service:
+  path: '/system-test/messenger-service'
   defaults:
-    _title: 'Set messages with drupal_set_message()'
-    _controller: '\Drupal\system_test\Controller\SystemTestController::drupalSetMessageTest'
+    _title: 'Set messages with Messenger service'
+    _controller: '\Drupal\system_test\Controller\SystemTestController::messengerServiceTest'
   requirements:
     _access: 'TRUE'
 
diff --git a/core/modules/system/tests/src/Functional/Bootstrap/DrupalSetMessageTest.php b/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php
similarity index 73%
rename from core/modules/system/tests/src/Functional/Bootstrap/DrupalSetMessageTest.php
rename to core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php
index 976e8bebfe3607902bfd137ee2ebe9dfe10d6ab3..51404ef18d17a9bc61252814918331853a5a90f3 100644
--- a/core/modules/system/tests/src/Functional/Bootstrap/DrupalSetMessageTest.php
+++ b/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php
@@ -2,14 +2,15 @@
 
 namespace Drupal\Tests\system\Functional\Bootstrap;
 
+use Drupal\Core\Url;
 use Drupal\Tests\BrowserTestBase;
 
 /**
- * Tests drupal_set_message() and related functions.
+ * Tests the Messenger service.
  *
  * @group Bootstrap
  */
-class DrupalSetMessageTest extends BrowserTestBase {
+class DrupalMessengerServiceTest extends BrowserTestBase {
 
   /**
    * Modules to enable.
@@ -19,12 +20,12 @@ class DrupalSetMessageTest extends BrowserTestBase {
   public static $modules = ['system_test'];
 
   /**
-   * Tests drupal_set_message().
+   * Tests Messenger service.
    */
-  public function testDrupalSetMessage() {
-    // The page at system-test/drupal-set-message sets two messages and then
-    // removes the first before it is displayed.
-    $this->drupalGet('system-test/drupal-set-message');
+  public function testDrupalMessengerService() {
+    // The page at system_test.messenger_service route sets two messages and
+    // then removes the first before it is displayed.
+    $this->drupalGet(Url::fromRoute('system_test.messenger_service'));
     $this->assertNoText('First message (removed).');
     $this->assertRaw(t('Second message with <em>markup!</em> (not removed).'));