CreateBranch: Test that branches cannot be created with invalid names

This increases the test coverage of the CreateBranch REST endpoint.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I86e46cf34e49172be2fb15e8970c5dca5aa2dd1f
diff --git a/javatests/com/google/gerrit/acceptance/rest/project/CreateBranchIT.java b/javatests/com/google/gerrit/acceptance/rest/project/CreateBranchIT.java
index 0cd4964..23b743a 100644
--- a/javatests/com/google/gerrit/acceptance/rest/project/CreateBranchIT.java
+++ b/javatests/com/google/gerrit/acceptance/rest/project/CreateBranchIT.java
@@ -337,6 +337,14 @@
   }
 
   @Test
+  public void cannotCreateBranchWithInvalidName() throws Exception {
+    assertCreateFails(
+        BranchNameKey.create(project, RefNames.REFS_HEADS),
+        BadRequestException.class,
+        "invalid branch name \"" + RefNames.REFS_HEADS + "\"");
+  }
+
+  @Test
   public void createBranchLeadingSlashesAreRemoved() throws Exception {
     BranchNameKey expectedNameKey = BranchNameKey.create(project, "test");