Merge "Check null NetworkSpecifier before redacting"

This commit is contained in:
Junyu Lai
2021-06-25 15:27:55 +00:00
committed by Gerrit Code Review

View File

@@ -536,8 +536,10 @@ public class ConnectivityManagerTest {
Objects.requireNonNull(mCm.getNetworkCapabilities(network));
// Redact specifier of the capabilities of the snapshot before comparing since
// the result returned from getNetworkCapabilities always get redacted.
final NetworkSpecifier snapshotCapSpecifier =
snapshot.getNetworkCapabilities().getNetworkSpecifier();
final NetworkSpecifier redactedSnapshotCapSpecifier =
snapshot.getNetworkCapabilities().getNetworkSpecifier().redact();
snapshotCapSpecifier == null ? null : snapshotCapSpecifier.redact();
assertEquals("", caps.describeImmutableDifferences(
snapshot.getNetworkCapabilities()
.setNetworkSpecifier(redactedSnapshotCapSpecifier)));