Reformat with GJF Change-Id: I5422cfd7bce3b3ce0c3bf1960efdb10639c350ef
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java index de22f9c..fe25bb7 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java +++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
@@ -208,8 +208,7 @@ * <p>When no pattern is specified, it will return a pattern which never matches. */ public Optional<Pattern> getDummyIssuePattern() { - return Optional.ofNullable(getPluginConfigString("dummyIssuePattern")) - .map(Pattern::compile); + return Optional.ofNullable(getPluginConfigString("dummyIssuePattern")).map(Pattern::compile); } /**
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java index ddb8a35..bca7675 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java +++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
@@ -58,7 +58,9 @@ properties.add(propertyFactory.create("branch", changeAttribute.branch)); properties.add(propertyFactory.create("topic", changeAttribute.topic)); properties.add(propertyFactory.create("subject", changeAttribute.subject)); - properties.add(propertyFactory.create("escapedSubject", StringEscapeUtils.escapeJava(changeAttribute.subject))); + properties.add( + propertyFactory.create( + "escapedSubject", StringEscapeUtils.escapeJava(changeAttribute.subject))); // deprecated, to be removed soon. migrate to ones without dash. properties.add(propertyFactory.create("commit-message", changeAttribute.commitMessage));
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java index 5fb3d85..69d8196 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java +++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
@@ -98,6 +98,7 @@ owner.username = "testUsername"; ChangeAttribute changeAttribute = new ChangeAttribute(); + changeAttribute.project = "testProject"; changeAttribute.branch = "testBranch"; changeAttribute.topic = "testTopic"; changeAttribute.subject = "testSubject"; @@ -107,6 +108,9 @@ changeAttribute.owner = owner; changeAttribute.commitMessage = "Commit Message"; + Property propertyProject = createMock(Property.class); + expect(propertyFactory.create("project", "testProject")).andReturn(propertyProject); + Property propertyBranch = createMock(Property.class); expect(propertyFactory.create("branch", "testBranch")).andReturn(propertyBranch); @@ -117,7 +121,8 @@ expect(propertyFactory.create("subject", "testSubject")).andReturn(propertySubject); Property propertyEscapedSubject = createMock(Property.class); - expect(propertyFactory.create("escapedSubject", "testSubject")).andReturn(propertyEscapedSubject); + expect(propertyFactory.create("escapedSubject", "testSubject")) + .andReturn(propertyEscapedSubject); Property propertyId2 = createMock(Property.class); expect(propertyFactory.create("change-id", "testId")).andReturn(propertyId2); @@ -182,6 +187,7 @@ Set<Property> actual = extractor.extractFrom(changeAttribute); Set<Property> expected = Sets.newHashSet(); + expected.add(propertyProject); expected.add(propertyBranch); expected.add(propertyTopic); expected.add(propertySubject); @@ -212,6 +218,7 @@ owner.username = "testUsername"; ChangeAttribute changeAttribute = new ChangeAttribute(); + changeAttribute.project = "testProject"; changeAttribute.branch = "testBranch"; changeAttribute.topic = "testTopic"; changeAttribute.subject = "testSubject"; @@ -222,6 +229,9 @@ changeAttribute.owner = owner; changeAttribute.commitMessage = "Commit Message"; + Property propertyProject = createMock(Property.class); + expect(propertyFactory.create("project", "testProject")).andReturn(propertyProject); + Property propertyBranch = createMock(Property.class); expect(propertyFactory.create("branch", "testBranch")).andReturn(propertyBranch); @@ -232,7 +242,8 @@ expect(propertyFactory.create("subject", "testSubject")).andReturn(propertySubject); Property propertyEscapedSubject = createMock(Property.class); - expect(propertyFactory.create("escapedSubject", "testSubject")).andReturn(propertyEscapedSubject); + expect(propertyFactory.create("escapedSubject", "testSubject")) + .andReturn(propertyEscapedSubject); Property propertyId = createMock(Property.class); expect(propertyFactory.create("changeId", "testId")).andReturn(propertyId); @@ -297,6 +308,7 @@ Set<Property> actual = extractor.extractFrom(changeAttribute); Set<Property> expected = Sets.newHashSet(); + expected.add(propertyProject); expected.add(propertyBranch); expected.add(propertyTopic); expected.add(propertySubject); @@ -446,6 +458,7 @@ RefUpdateAttribute refUpdateAttribute = new RefUpdateAttribute(); refUpdateAttribute.newRev = "1234567891123456789212345678931234567894"; refUpdateAttribute.oldRev = "9876543211987654321298765432139876543214"; + refUpdateAttribute.project = "testProject"; refUpdateAttribute.refName = "testRef"; Property propertyRevision = createMock(Property.class); @@ -460,6 +473,9 @@ expect(propertyFactory.create("revision-old", "9876543211987654321298765432139876543214")) .andReturn(propertyRevisionOld2); + Property propertyProject = createMock(Property.class); + expect(propertyFactory.create("project", "testProject")).andReturn(propertyProject); + Property propertyRef = createMock(Property.class); expect(propertyFactory.create("ref", "testRef")).andReturn(propertyRef); @@ -473,6 +489,7 @@ expected.add(propertyRevision); expected.add(propertyRevisionOld); expected.add(propertyRevisionOld2); + expected.add(propertyProject); expected.add(propertyRef); assertEquals("Properties do not match", expected, actual); }