Adapt to change in Gerrit core Change Ibe2d8b4f2 in Gerrit core improve the error message that is returned when there are file conflicts. Adapt the CodeOwnerConfigValidatorIT to this. Change-Id: Icf1a0319fc04600d2c492e4b3cff3c071566c0a3 Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CodeOwnerConfigValidatorIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CodeOwnerConfigValidatorIT.java index 4c1b823..ebf79b9 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CodeOwnerConfigValidatorIT.java +++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CodeOwnerConfigValidatorIT.java
@@ -564,7 +564,8 @@ r, "invalid push option", String.format( - "--code-owners~%s push option can be specified only once, received multiple values: [, false]", + "--code-owners~%s push option can be specified only once, received multiple values: [," + + " false]", SkipCodeOwnerConfigValidationPushOption.NAME)); } @@ -1124,7 +1125,8 @@ // the pre-existing issue is returned as warning r.assertMessage( String.format( - "warning: commit %s: [code-owners] code owner email '%s' in '%s' cannot be resolved for %s", + "warning: commit %s: [code-owners] code owner email '%s' in '%s' cannot be resolved for" + + " %s", abbreviatedCommit, unknownEmail1, codeOwnerConfigOperations.codeOwnerConfig(codeOwnerConfigKey).getFilePath(), @@ -2231,7 +2233,13 @@ assertThrows(MergeConflictException.class, () -> gApi.changes().create(changeInput)); assertThat(mergeConflictException) .hasMessageThat() - .isEqualTo(String.format("merge conflict(s):\n%s", getCodeOwnerConfigFileName())); + .isEqualTo( + String.format( + """ + merge conflict(s): + * %s + """, + getCodeOwnerConfigFileName())); // Try creating the merge change with conflicts. Fails because the code owner config file // contains conflict markers which fails the code owner config file validation. @@ -3275,7 +3283,8 @@ .isEqualTo( String.format( "Failed to submit 1 change due to the following problems:\n" - + "Change %s: [code-owners] invalid code owner config files (see %s for help):\n" + + "Change %s: [code-owners] invalid code owner config files (see %s for" + + " help):\n" + " ERROR: invalid %s import in '%s': project '%s' not found", r.getChange().getId().toString(), getHelpPage(), @@ -3435,8 +3444,10 @@ .isEqualTo( String.format( "Failed to submit 1 change due to the following problems:\n" - + "Change %s: [code-owners] invalid code owner config files (see %s for help):\n" - + " ERROR: invalid %s import in '%s': branch 'master' not found in project '%s'", + + "Change %s: [code-owners] invalid code owner config files (see %s for" + + " help):\n" + + " ERROR: invalid %s import in '%s': branch 'master' not found in project" + + " '%s'", r.getChange().getId().toString(), getHelpPage(), CodeOwnerConfigImportType.GLOBAL.getType(),