Address comments by Sasa Zivkov

Change-Id: I7e8fdd582a675322f10097dadaa47c04526e6578
diff --git a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/UploadValidatorIT.java b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/UploadValidatorIT.java
index e248540..a558336 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/UploadValidatorIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/UploadValidatorIT.java
@@ -18,6 +18,7 @@
 import static com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.allow;
 import static com.google.gerrit.testing.GerritJUnit.assertThrows;
 
+import com.google.common.base.Joiner;
 import com.google.common.collect.ImmutableMap;
 import com.google.gerrit.acceptance.GitUtil;
 import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
@@ -42,8 +43,7 @@
     sysModule = "com.googlesource.gerrit.plugins.uploadvalidator.Module")
 public class UploadValidatorIT extends LightweightPluginDaemonTest {
 
-  @Inject
-  ProjectOperations projectOperations;
+  @Inject ProjectOperations projectOperations;
 
   TestRepository<InMemoryRepository> clone;
 
@@ -52,32 +52,35 @@
     GitUtil.fetch(allProjectRepo, RefNames.REFS_CONFIG + ":config");
     allProjectRepo.reset("config");
     PushOneCommit push =
-        pushFactory.create(
-            admin.newIdent(), allProjectRepo, "Subject", "project.config", config);
-    PushOneCommit.Result res = push.to("refs/meta/config");
+        pushFactory.create(admin.newIdent(), allProjectRepo, "Subject", "project.config", config);
+    PushOneCommit.Result res = push.to(RefNames.REFS_CONFIG);
     res.assertOkStatus();
   }
 
   @Before
   public void setup() throws Exception {
-    pushConfig("[plugin \"uploadvalidator\"]\n" +
-        "    blockedFileExtension = jar\n" +
-        "    blockedFileExtension = .zip\n" +
-        "    blockedKeywordPattern = secr3t\n" +
-        "    invalidFilenamePattern = [%:@]\n" +
-        "    rejectWindowsLineEndings = true\n" +
-        "    maxPathLength = 20\n" +
-        "    rejectDuplicatePathnames = true\n" +
-        "");
 
-    projectOperations.project(allProjects).forUpdate()
+    pushConfig(
+        Joiner.on("\n")
+            .join(
+                "[plugin \"uploadvalidator\"]",
+                "    blockedFileExtension = jar",
+                "    blockedFileExtension = .zip",
+                "    blockedKeywordPattern = secr3t",
+                "    invalidFilenamePattern = [%:@]",
+                "    rejectWindowsLineEndings = true",
+                "    maxPathLength = 20",
+                "    rejectDuplicatePathnames = true"));
+
+    projectOperations
+        .project(allProjects)
+        .forUpdate()
         .add(allow(Permission.READ).ref("refs/*").group(SystemGroupBackend.REGISTERED_USERS))
         .add(allow(Permission.CREATE).ref("refs/*").group(SystemGroupBackend.REGISTERED_USERS))
         .add(allow(Permission.PUSH).ref("refs/*").group(SystemGroupBackend.REGISTERED_USERS))
         .update();
 
-    clone =
-        GitUtil.cloneProject(project, registerRepoConnection(project, admin));
+    clone = GitUtil.cloneProject(project, registerRepoConnection(project, admin));
   }
 
   @Test
@@ -94,7 +97,7 @@
   }
 
   @Test
-  public void testKeywordComment() throws Exception {
+  public void testKeywordInComment() throws Exception {
     PushOneCommit.Result r1 = createChange("Subject", "file.txt", "content");
     DraftInput in = new DraftInput();
     in.message = "the password is secr3t ! ";
@@ -103,20 +106,21 @@
 
     ReviewInput reviewIn = new ReviewInput();
     reviewIn.drafts = DraftHandling.PUBLISH;
-    BadRequestException e = assertThrows(
-        BadRequestException.class,
-        () -> gApi.changes().id(r1.getChangeId()).revision("current").review(reviewIn)
-    );
+    BadRequestException e =
+        assertThrows(
+            BadRequestException.class,
+            () -> gApi.changes().id(r1.getChangeId()).revision("current").review(reviewIn));
     assertThat(e.getMessage()).contains("banned words");
   }
 
   @Test
-  public void testKeyword() throws Exception {
+  public void testKeywordInFile() throws Exception {
     pushFactory
         .create(admin.newIdent(), clone, "Subject", "file.txt", "blah secr3t blah")
         .to("refs/heads/master")
         .assertErrorStatus("blocked keywords");
   }
+
   @Test
   public void testFilenamePattern() throws Exception {
     pushFactory
@@ -128,8 +132,7 @@
   @Test
   public void testWindowsLineEndings() throws Exception {
     pushFactory
-        .create(admin.newIdent(), clone, "Subject", "win.ini",
-            "content\r\nline2\r\n")
+        .create(admin.newIdent(), clone, "Subject", "win.ini", "content\r\nline2\r\n")
         .to("refs/heads/master")
         .assertErrorStatus("Windows line ending");
   }
@@ -137,7 +140,10 @@
   @Test
   public void testPathLength() throws Exception {
     pushFactory
-        .create(admin.newIdent(), clone, "Subject",
+        .create(
+            admin.newIdent(),
+            clone,
+            "Subject",
             "123456789012345678901234567890.txt",
             "content\nline2\n")
         .to("refs/heads/master")
@@ -147,14 +153,12 @@
   @Test
   public void testUniqueName() throws Exception {
     pushFactory
-        .create(admin.newIdent(), clone, "Subject",
-            ImmutableMap.of("a.txt",
-            "content\nline2\n",
-            "A.TXT",
-            "content")
-        )
+        .create(
+            admin.newIdent(),
+            clone,
+            "Subject",
+            ImmutableMap.of("a.txt", "content\nline2\n", "A.TXT", "content"))
         .to("refs/heads/master")
         .assertErrorStatus("duplicate pathnames");
   }
-
 }