diff --git a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
index d6083e1..6d34a4f 100644
--- a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
+++ b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php
@@ -174,7 +174,7 @@ public function testUIFieldAlias() {
 
     // Test a random aliases for fields, they should be replaced.
     $random_name = $this->randomName();
-    $random_string = $this->randomString();
+    $random_string = trim($this->randomString());
     $edit = array('row_options[aliases][name]' => $random_name, 'row_options[aliases][nothing]' => $random_string);
     $this->drupalPost($row_options, $edit, t('Apply'));
     $this->drupalPost(NULL, array(), t('Save'));
