Merge "Use String#lines() rather than String#split()"

This commit is contained in:
Treehugger Robot
2023-05-12 18:37:31 +00:00
committed by Gerrit Code Review
2 changed files with 5 additions and 3 deletions

View File

@@ -31,6 +31,7 @@ android_test {
"service-rkp.impl", "service-rkp.impl",
"services.core", "services.core",
"truth-prebuilt", "truth-prebuilt",
"truth-java8-extension-jar",
], ],
test_suites: [ test_suites: [
"device-tests", "device-tests",

View File

@@ -17,6 +17,7 @@
package com.android.server.security.rkp; package com.android.server.security.rkp;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -42,7 +43,6 @@ import org.junit.runner.RunWith;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.util.Arrays;
import java.util.Base64; import java.util.Base64;
import java.util.Map; import java.util.Map;
@@ -119,6 +119,7 @@ public class RemoteProvisioningShellCommandTest {
assertThat(res.getErr()).isEmpty(); assertThat(res.getErr()).isEmpty();
assertThat(res.getCode()).isEqualTo(0); assertThat(res.getCode()).isEqualTo(0);
assertThat(res.getOut()).isEmpty(); assertThat(res.getOut()).isEmpty();
assertThat(res.getOut().lines()).isEmpty();
} }
@Test @Test
@@ -128,7 +129,7 @@ public class RemoteProvisioningShellCommandTest {
CommandResult res = exec(cmd, new String[] {"list"}); CommandResult res = exec(cmd, new String[] {"list"});
assertThat(res.getErr()).isEmpty(); assertThat(res.getErr()).isEmpty();
assertThat(res.getCode()).isEqualTo(0); assertThat(res.getCode()).isEqualTo(0);
assertThat(Arrays.asList(res.getOut().split("\n"))).containsExactly("default"); assertThat(res.getOut().lines()).containsExactly("default");
} }
@Test @Test
@@ -140,7 +141,7 @@ public class RemoteProvisioningShellCommandTest {
CommandResult res = exec(cmd, new String[] {"list"}); CommandResult res = exec(cmd, new String[] {"list"});
assertThat(res.getErr()).isEmpty(); assertThat(res.getErr()).isEmpty();
assertThat(res.getCode()).isEqualTo(0); assertThat(res.getCode()).isEqualTo(0);
assertThat(Arrays.asList(res.getOut().split("\n"))).containsExactly("default", "strongbox"); assertThat(res.getOut().lines()).containsExactly("default", "strongbox");
} }
@Test @Test