Check null NetworkSpecifier before redacting am: 4ad09c4a74

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15121422

Change-Id: I9092bfd9eedf04b68fc5f6d8091dcff733d943b7
This commit is contained in:
Junyu Lai
2021-06-28 06:19:10 +00:00
committed by Automerger Merge Worker

View File

@@ -537,8 +537,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)));