SshCommandsIT: Replace ArrayList subclass with stream expression

Change-Id: Ibf93d35942b7ef86bae4979736e47953c90e7290
This commit is contained in:
Dave Borowitz
2018-08-31 11:44:26 -07:00
parent ddae6dff9d
commit d29fe44c1b

View File

@@ -14,12 +14,14 @@
package com.google.gerrit.acceptance.ssh;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Streams;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.NoHttpd;
@@ -28,7 +30,6 @@ import com.google.gerrit.acceptance.UseSsh;
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.sshd.Commands;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.junit.Test;
@@ -82,16 +83,9 @@ public class SshCommandsIT extends AbstractDaemonTest {
private static final ImmutableMap<String, List<String>> MASTER_COMMANDS =
ImmutableMap.of(
Commands.ROOT,
ImmutableList.copyOf(
new ArrayList<String>() {
private static final long serialVersionUID = 1L;
{
addAll(COMMON_ROOT_COMMANDS);
addAll(MASTER_ONLY_ROOT_COMMANDS);
Collections.sort(this);
}
}),
Streams.concat(COMMON_ROOT_COMMANDS.stream(), MASTER_ONLY_ROOT_COMMANDS.stream())
.sorted()
.collect(toImmutableList()),
"index",
ImmutableList.of(
"changes", "changes-in-project"), // "activate" and "start" are not included