Fix formatting issues that were introduced by recent change
Run google-java-format for all files touched by change I92e223d0d that
forgot to format the files.
Change-Id: I8089fe055ab5e7a6493df51373710b4b012d62e1
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScorings.java b/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScorings.java
index 7a283cd..8c80fc0 100644
--- a/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScorings.java
+++ b/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerScorings.java
@@ -17,11 +17,8 @@
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import com.google.auto.value.AutoValue;
-import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -68,8 +65,7 @@
public ImmutableMap<CodeOwnerScore, Integer> getScoringsByScore(CodeOwner codeOwner) {
ImmutableMap.Builder<CodeOwnerScore, Integer> builder = ImmutableMap.builder();
for (CodeOwnerScoring scoring : scorings()) {
- scoring.bestValue(codeOwner)
- .ifPresent(value -> builder.put(scoring.score(), value));
+ scoring.bestValue(codeOwner).ifPresent(value -> builder.put(scoring.score(), value));
}
return builder.build();
}
diff --git a/java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java b/java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java
index d94879b..8c6d010 100644
--- a/java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java
+++ b/java/com/google/gerrit/plugins/codeowners/restapi/AbstractGetCodeOwnersForPath.java
@@ -339,8 +339,10 @@
sortedAndLimitedCodeOwners.stream()
.map(codeOwner -> Pair.of(codeOwner, codeOwnerScorings.getScoringsByScore(codeOwner)))
.collect(toImmutableMap(Pair::key, Pair::value));
- ImmutableList<CodeOwnerInfo> codeOwnersInfoList = codeOwnerJsonFactory.create(getFillOptions())
- .format(sortedAndLimitedCodeOwners, codeOwnerToScorings);
+ ImmutableList<CodeOwnerInfo> codeOwnersInfoList =
+ codeOwnerJsonFactory
+ .create(getFillOptions())
+ .format(sortedAndLimitedCodeOwners, codeOwnerToScorings);
CodeOwnersInfo codeOwnersInfo = new CodeOwnersInfo();
codeOwnersInfo.codeOwners = codeOwnersInfoList;
diff --git a/java/com/google/gerrit/plugins/codeowners/restapi/CodeOwnerJson.java b/java/com/google/gerrit/plugins/codeowners/restapi/CodeOwnerJson.java
index 7739500..09f7bbe 100644
--- a/java/com/google/gerrit/plugins/codeowners/restapi/CodeOwnerJson.java
+++ b/java/com/google/gerrit/plugins/codeowners/restapi/CodeOwnerJson.java
@@ -87,14 +87,17 @@
* @param scorings the scorings data that should be populated in {@link CodeOwnerInfo}s
* @return the provided code owner as {@link CodeOwnerInfo}
*/
- private static CodeOwnerInfo format(AccountLoader accountLoader, CodeOwner codeOwner,
+ private static CodeOwnerInfo format(
+ AccountLoader accountLoader,
+ CodeOwner codeOwner,
ImmutableMap<CodeOwnerScore, Integer> scorings) {
CodeOwnerInfo info = new CodeOwnerInfo();
info.account = accountLoader.get(requireNonNull(codeOwner, "codeOwner").accountId());
if (scorings != null) {
- info.scorings = scorings.entrySet().stream()
- .map(e -> Pair.of(e.getKey().name(), e.getValue()))
- .collect(toImmutableMap(Pair::key, Pair::value));
+ info.scorings =
+ scorings.entrySet().stream()
+ .map(e -> Pair.of(e.getKey().name(), e.getValue()))
+ .collect(toImmutableMap(Pair::key, Pair::value));
}
return info;
}
diff --git a/java/com/google/gerrit/plugins/codeowners/testing/CodeOwnerInfoSubject.java b/java/com/google/gerrit/plugins/codeowners/testing/CodeOwnerInfoSubject.java
index de3d37a..7e858c6 100644
--- a/java/com/google/gerrit/plugins/codeowners/testing/CodeOwnerInfoSubject.java
+++ b/java/com/google/gerrit/plugins/codeowners/testing/CodeOwnerInfoSubject.java
@@ -44,11 +44,12 @@
/** Constructs a {@link Correspondence} that maps {@link CodeOwnerInfo}s to scoring. */
public static final Correspondence<CodeOwnerInfo, Integer> hasScoring(CodeOwnerScore score) {
return NullAwareCorrespondence.transforming(
- codeOwnerInfo -> codeOwnerInfo.scorings.entrySet().stream()
- .filter(factor -> factor.getKey().equals(score.name()))
- .findFirst()
- .orElseThrow()
- .getValue(),
+ codeOwnerInfo ->
+ codeOwnerInfo.scorings.entrySet().stream()
+ .filter(factor -> factor.getKey().equals(score.name()))
+ .findFirst()
+ .orElseThrow()
+ .getValue(),
"has scoring");
}
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/AbstractGetCodeOwnersForPathIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/AbstractGetCodeOwnersForPathIT.java
index 2351c90..f2fc686 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/AbstractGetCodeOwnersForPathIT.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/AbstractGetCodeOwnersForPathIT.java
@@ -390,8 +390,8 @@
@Test
public void
- cannotGetCodeOwnersWithSecondaryEmailsWithoutViewSecondaryEmailAndWithoutModifyAccountCapability()
- throws Exception {
+ cannotGetCodeOwnersWithSecondaryEmailsWithoutViewSecondaryEmailAndWithoutModifyAccountCapability()
+ throws Exception {
// create a code owner config
codeOwnerConfigOperations
.newCodeOwnerConfig()
@@ -1420,9 +1420,9 @@
.collect(toList());
for (int i = 0; i < 10; i++) {
assertThat(
- queryCodeOwners(
- getCodeOwnersApi().query().setResolveAllUsers(true).withSeed(seed),
- "/foo/bar/baz.md"))
+ queryCodeOwners(
+ getCodeOwnersApi().query().setResolveAllUsers(true).withSeed(seed),
+ "/foo/bar/baz.md"))
.hasCodeOwnersThat()
.comparingElementsUsing(hasAccountId())
.containsExactlyElementsIn(expectedAccountIds)
@@ -1972,7 +1972,6 @@
.assertNoUnresolvedErrorMessage();
}
-
@Test
public void testCodeOwnersScoringsDistance() throws Exception {
TestAccount user2 = accountCreator.user2();
@@ -2001,8 +2000,7 @@
.addCodeOwnerEmail(user2.email())
.create();
- CodeOwnersInfo codeOwnersInfo =
- queryCodeOwners("/foo/bar/baz.md");
+ CodeOwnersInfo codeOwnersInfo = queryCodeOwners("/foo/bar/baz.md");
assertThat(codeOwnersInfo)
.hasCodeOwnersThat()
.comparingElementsUsing(hasAccountId())
@@ -2019,7 +2017,6 @@
.inOrder();
}
-
@Test
@GerritConfig(name = "accounts.visibility", value = "ALL")
public void testCodeOwnersScoringsIsExplicitlyMentioned() throws Exception {
diff --git a/javatests/com/google/gerrit/plugins/codeowners/restapi/CodeOwnerJsonTest.java b/javatests/com/google/gerrit/plugins/codeowners/restapi/CodeOwnerJsonTest.java
index 498ff09..5c01956 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/restapi/CodeOwnerJsonTest.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/restapi/CodeOwnerJsonTest.java
@@ -51,8 +51,10 @@
@Test
public void formatEmptyListOfCodeOwners() throws Exception {
- assertThat(codeOwnerJsonFactory.create(EnumSet.of(FillOptions.ID))
- .format(ImmutableList.of(), ImmutableMap.of()))
+ assertThat(
+ codeOwnerJsonFactory
+ .create(EnumSet.of(FillOptions.ID))
+ .format(ImmutableList.of(), ImmutableMap.of()))
.isEmpty();
}
@@ -61,7 +63,9 @@
ImmutableList<CodeOwnerInfo> codeOwnerInfos =
codeOwnerJsonFactory
.create(EnumSet.of(FillOptions.ID))
- .format(ImmutableList.of(CodeOwner.create(admin.id()), CodeOwner.create(user.id())), ImmutableMap.of());
+ .format(
+ ImmutableList.of(CodeOwner.create(admin.id()), CodeOwner.create(user.id())),
+ ImmutableMap.of());
assertThat(codeOwnerInfos)
.comparingElementsUsing(hasAccountId())
.containsExactly(admin.id(), user.id())
@@ -74,7 +78,9 @@
ImmutableList<CodeOwnerInfo> codeOwnerInfos =
codeOwnerJsonFactory
.create(EnumSet.of(FillOptions.ID, FillOptions.NAME))
- .format(ImmutableList.of(CodeOwner.create(admin.id()), CodeOwner.create(user.id())), ImmutableMap.of());
+ .format(
+ ImmutableList.of(CodeOwner.create(admin.id()), CodeOwner.create(user.id())),
+ ImmutableMap.of());
assertThat(codeOwnerInfos)
.comparingElementsUsing(hasAccountId())
.containsExactly(admin.id(), user.id())
@@ -85,7 +91,6 @@
.inOrder();
}
-
@Test
public void formatCodeOwnersWithAccountIdAndScorings() throws Exception {
CodeOwner adminCodeOwner = CodeOwner.create(admin.id());
@@ -101,8 +106,7 @@
ImmutableList<CodeOwnerInfo> codeOwnerInfos =
codeOwnerJsonFactory
.create(EnumSet.of(FillOptions.ID))
- .format(ImmutableList.of(adminCodeOwner, userCodeOwner),
- scorings);
+ .format(ImmutableList.of(adminCodeOwner, userCodeOwner), scorings);
assertThat(codeOwnerInfos)
.comparingElementsUsing(hasAccountId())
.containsExactly(admin.id(), user.id())