ChangedFilesTest: Set project when creating test changes When creating a test change without specifying a project the change is created in an arbitrary project. Since the project is arbitrary tests that create multiple changes cannot assume that all changes are created in the same project, when no project is being specified. So far this was not a problem, since always the same arbitrary project has been selected, but with change I88f26dd6a in Gerrit core this is changing now. That change makes it so that every change is created in a new project, if no project was specified. This makes some tests in ChangedFilesTest fail. Fix them by setting the project when creating test changes. Change-Id: Ic61a2bfc687a9081d666bc1524df7e2d41f7d9b5 Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/ChangedFilesTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/ChangedFilesTest.java index e82a2aa..7aaef7c 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/ChangedFilesTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/ChangedFilesTest.java
@@ -238,7 +238,13 @@ // Create a base change. Change.Id baseChange = - changeOperations.newChange().branch("master").file(file1).content("base content").create(); + changeOperations + .newChange() + .project(project) + .branch("master") + .file(file1) + .content("base content") + .create(); approveAndSubmit(baseChange); // Create another branch @@ -252,6 +258,7 @@ Change.Id changeInMaster = changeOperations .newChange() + .project(project) .branch("master") .file(file1) .content("master content") @@ -262,6 +269,7 @@ Change.Id changeInOtherBranch = changeOperations .newChange() + .project(project) .branch(branchName) .file(file1) .content("other content") @@ -275,6 +283,7 @@ Change.Id mergeChange = changeOperations .newChange() + .project(project) .branch("master") .mergeOfButBaseOnFirst() .tipOfBranch("master") @@ -329,7 +338,13 @@ // Create a base change. Change.Id baseChange = - changeOperations.newChange().branch("master").file(file).content("base content").create(); + changeOperations + .newChange() + .project(project) + .branch("master") + .file(file) + .content("base content") + .create(); approveAndSubmit(baseChange); // Create another branch @@ -341,7 +356,13 @@ // Create a change in master that touches file1. Change.Id changeInMaster = - changeOperations.newChange().branch("master").file(file).content("master content").create(); + changeOperations + .newChange() + .project(project) + .branch("master") + .file(file) + .content("master content") + .create(); approveAndSubmit(changeInMaster); // Create a change in the other branch and that deleted file1. @@ -356,6 +377,7 @@ Change.Id mergeChange = changeOperations .newChange() + .project(project) .branch("master") .mergeOf() .tipOfBranch("master") @@ -440,6 +462,7 @@ Change.Id baseChange = changeOperations .newChange() + .project(project) .branch("master") .file(file1) .content("base content") @@ -461,6 +484,7 @@ Change.Id changeInMaster = changeOperations .newChange() + .project(project) .branch("master") .file(file1) .content("master content") @@ -476,6 +500,7 @@ Change.Id changeInOtherBranch = changeOperations .newChange() + .project(project) .branch(branchName) .file(file1) .content("other content") @@ -495,6 +520,7 @@ Change.Id mergeChange = changeOperations .newChange() + .project(project) .branch("master") .mergeOfButBaseOnFirst() .tipOfBranch("master")