Fix test for Gerrit's 3.9+

The following issues were fixed:
* the Soy template name no longer supports `.` in front of it - failing
  with:

  com.google.template.soy.error.SoyCompilationException: errors during Soy compilation
  /Users/jcentkowski/workspace/open/gerrit/target/random_name_8693f312_7c74_4925_8770_b7fc505f25e9/etc/its/templates/parameterEscapingDefault.soy:1: error: parse error at '.': expected identifier
  1: {namespace etc.its.templates}{template .parameterEscapingDefault}{@param param1:string}{$param1}{/template}
                                          ^

* mocks should have all methods that are expected to be called stubbed;
  the problem was that older versions of mockito honoured methods
  overriden in child classes and call to `getType` returned the expected
  type- failing wiht:

  1) testAddCommentDelegation(com.googlesource.gerrit.plugins.its.base.workflow.ActionExecutorTest)
  Wanted but not invoked:
  addComment.execute(
      Mock for ItsFacade, hashCode: 1629241006,
      "4711",
      Mock for ActionRequest, hashCode: 1389865849,
      {"issue" = "4711", "project" = "testProject"}
  );
  -> at com.googlesource.gerrit.plugins.its.base.workflow.AddComment.execute(AddComment.java:36)

Change was verified with `stable-3.9`, `stable-3.10` and `master`

Bug: Issue 338535762
Change-Id: I94ab03f446c2f108de0ca7dd4da334b8f51f4e02
diff --git a/src/main/resources/Documentation/config-rulebase-common.md b/src/main/resources/Documentation/config-rulebase-common.md
index 303aed6..5a45364 100644
--- a/src/main/resources/Documentation/config-rulebase-common.md
+++ b/src/main/resources/Documentation/config-rulebase-common.md
@@ -658,7 +658,7 @@
 
 ```
 {namespace etc.its.templates}
-{template .TemplateName kind="text"}
+{template TemplateName kind="text"}
   {@param changeNumber: string}
   {@param formatChangeUrl: string}
   Comment for change {$changeNumber} added. See {$formatChangeUrl}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java
index 822602b..438bd94 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionExecutorTest.java
@@ -149,7 +149,7 @@
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    AddComment addComment = mock(AddComment.class);
+    AddComment addComment = mockIssueAction(AddComment.class);
     when(addCommentFactory.create()).thenReturn(addComment);
     when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
@@ -165,7 +165,7 @@
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    AddSoyComment addSoyComment = mock(AddSoyComment.class);
+    AddSoyComment addSoyComment = mockIssueAction(AddSoyComment.class);
     when(addSoyCommentFactory.create()).thenReturn(addSoyComment);
     when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
@@ -181,7 +181,7 @@
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    AddStandardComment addStandardComment = mock(AddStandardComment.class);
+    AddStandardComment addStandardComment = mockIssueAction(AddStandardComment.class);
     when(addStandardCommentFactory.create()).thenReturn(addStandardComment);
     when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
@@ -197,7 +197,7 @@
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    LogEvent logEvent = mock(LogEvent.class);
+    LogEvent logEvent = mockIssueAction(LogEvent.class);
     when(logEventFactory.create()).thenReturn(logEvent);
     when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
@@ -211,7 +211,7 @@
     ActionRequest actionRequest = mock(ActionRequest.class);
     when(actionRequest.getName()).thenReturn("create-version-from-property");
 
-    CreateVersionFromProperty createVersionFromProperty = mock(CreateVersionFromProperty.class);
+    CreateVersionFromProperty createVersionFromProperty = mockProjectAction(CreateVersionFromProperty.class);
     when(createVersionFromPropertyFactory.create()).thenReturn(createVersionFromProperty);
     when(itsFacadeFactory.getFacade(Project.nameKey(projectProperties.get("project"))))
         .thenReturn(its);
@@ -229,7 +229,7 @@
 
     Set<ActionRequest> actionRequests = ImmutableSet.of(actionRequest);
 
-    AddPropertyToField addPropertyToField = mock(AddPropertyToField.class);
+    AddPropertyToField addPropertyToField = mockIssueAction(AddPropertyToField.class);
     when(addPropertyToFieldFactory.create()).thenReturn(addPropertyToField);
     when(itsFacadeFactory.getFacade(Project.nameKey(properties.get("project")))).thenReturn(its);
 
@@ -243,7 +243,7 @@
     ActionRequest actionRequest = mock(ActionRequest.class);
     when(actionRequest.getName()).thenReturn("fire-event-on-commits");
 
-    FireEventOnCommits fireEventOnCommits = mock(FireEventOnCommits.class);
+    FireEventOnCommits fireEventOnCommits = mockProjectAction(FireEventOnCommits.class);
     when(fireEventOnCommitsFactory.create()).thenReturn(fireEventOnCommits);
     when(itsFacadeFactory.getFacade(Project.nameKey(projectProperties.get("project"))))
         .thenReturn(its);
@@ -288,6 +288,18 @@
     return injector.getInstance(ActionExecutor.class);
   }
 
+  private static <T extends IssueAction> T mockIssueAction(Class<T> clazz) {
+    T action = mock(clazz);
+    when(action.getType()).thenReturn(ActionType.ISSUE);
+    return action;
+  }
+
+  private static <T extends ProjectAction> T mockProjectAction(Class<T> clazz) {
+    T action = mock(clazz);
+    when(action.getType()).thenReturn(ActionType.PROJECT);
+    return action;
+  }
+
   @Override
   public void setUp() throws Exception {
     super.setUp();
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddSoyCommentTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddSoyCommentTest.java
index 8b9e974..b649b5f 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddSoyCommentTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/AddSoyCommentTest.java
@@ -169,7 +169,7 @@
     Path templatePath = itsPath.resolve("templates").resolve(name + ".soy");
     Files.createDirectories(templatePath.getParent());
     String namespace = "{namespace etc.its.templates}";
-    String opening = "{template ." + name + (kind != null ? (" kind=\"" + kind + "\"") : "") + "}";
+    String opening = "{template " + name + (kind != null ? (" kind=\"" + kind + "\"") : "") + "}";
     String closing = "{/template}";
 
     String fullTemplate = namespace + opening + content + closing;