CreateBranch: Test rejection if branch name in URL and input mismatch
This increases the test coverage of the CreateBranch REST endpoint. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: I32bba5a086ab3630a496d0766e2a74af26b37611
This commit is contained in:
		@@ -365,6 +365,17 @@ public class CreateBranchIT extends AbstractDaemonTest {
 | 
			
		||||
        .isEqualTo(expectedNameKey.branch());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Test
 | 
			
		||||
  public void branchNameInInputMustMatchBranchNameInUrl() throws Exception {
 | 
			
		||||
    BranchInput branchInput = new BranchInput();
 | 
			
		||||
    branchInput.ref = "foo";
 | 
			
		||||
    BadRequestException ex =
 | 
			
		||||
        assertThrows(
 | 
			
		||||
            BadRequestException.class,
 | 
			
		||||
            () -> gApi.projects().name(project.get()).branch("bar").create(branchInput));
 | 
			
		||||
    assertThat(ex).hasMessageThat().isEqualTo("ref must match URL");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private void blockCreateReference() throws Exception {
 | 
			
		||||
    projectOperations
 | 
			
		||||
        .project(project)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user