Revert "ConnectivityServiceTest: more informative assert failures"

CL https://android-review.googlesource.com/#/c/420720/ is
breaking several internal builds, and CL
https://android-review.googlesource.com/#/c/422480/ must
be reverted beforehand.

This reverts commit a6981669c4e2707bcfb3db001e262b2da4bb9c17.

Change-Id: I5883409452d39e1834e183aa7b5ccdbf14291ca5
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index 09b9823..aeb75e1 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -887,7 +887,7 @@
         assertNull(mCm.getActiveNetwork());
         assertNull(mCm.getActiveNetworkForUid(Process.myUid()));
         // Test getAllNetworks()
-        assertEmpty(mCm.getAllNetworks());
+        assertEquals(0, mCm.getAllNetworks().length);
     }
 
     /**
@@ -928,7 +928,7 @@
         mCellNetworkAgent.connect(true);
         waitFor(cv);
         verifyActiveNetwork(TRANSPORT_CELLULAR);
-        assertLength(2, mCm.getAllNetworks());
+        assertEquals(2, mCm.getAllNetworks().length);
         assertTrue(mCm.getAllNetworks()[0].equals(mCm.getActiveNetwork()) ||
                 mCm.getAllNetworks()[1].equals(mCm.getActiveNetwork()));
         assertTrue(mCm.getAllNetworks()[0].equals(mWiFiNetworkAgent.getNetwork()) ||
@@ -938,7 +938,7 @@
         mWiFiNetworkAgent.connect(true);
         waitFor(cv);
         verifyActiveNetwork(TRANSPORT_WIFI);
-        assertLength(2, mCm.getAllNetworks());
+        assertEquals(2, mCm.getAllNetworks().length);
         assertTrue(mCm.getAllNetworks()[0].equals(mCm.getActiveNetwork()) ||
                 mCm.getAllNetworks()[1].equals(mCm.getActiveNetwork()));
         assertTrue(mCm.getAllNetworks()[0].equals(mCellNetworkAgent.getNetwork()) ||
@@ -946,9 +946,9 @@
         // Test cellular linger timeout.
         waitFor(mCellNetworkAgent.getDisconnectedCV());
         waitForIdle();
-        assertLength(1, mCm.getAllNetworks());
+        assertEquals(1, mCm.getAllNetworks().length);
         verifyActiveNetwork(TRANSPORT_WIFI);
-        assertLength(1, mCm.getAllNetworks());
+        assertEquals(1, mCm.getAllNetworks().length);
         assertEquals(mCm.getAllNetworks()[0], mCm.getActiveNetwork());
         // Test WiFi disconnect.
         cv = waitForConnectivityBroadcasts(1);
@@ -1888,7 +1888,7 @@
         mCellNetworkAgent.connectWithoutInternet();
         waitFor(cv);
         waitForIdle();
-        assertEmpty(mCm.getAllNetworks());
+        assertEquals(0, mCm.getAllNetworks().length);
         verifyNoNetwork();
 
         // Test bringing up validated WiFi.
@@ -2562,7 +2562,7 @@
         assertTrue(testFactory.getMyStartRequested());
 
         // Bring up cell data and check that the factory stops looking.
-        assertLength(1, mCm.getAllNetworks());
+        assertEquals(1, mCm.getAllNetworks().length);
         mCellNetworkAgent = new MockNetworkAgent(TRANSPORT_CELLULAR);
         testFactory.expectAddRequests(2);  // Because the cell request changes score twice.
         mCellNetworkAgent.connect(true);
@@ -2573,7 +2573,7 @@
         // Check that cell data stays up.
         waitForIdle();
         verifyActiveNetwork(TRANSPORT_WIFI);
-        assertLength(2, mCm.getAllNetworks());
+        assertEquals(2, mCm.getAllNetworks().length);
 
         // Turn off mobile data always on and expect the request to disappear...
         testFactory.expectRemoveRequests(1);
@@ -2582,7 +2582,7 @@
 
         // ...  and cell data to be torn down.
         cellNetworkCallback.expectCallback(CallbackState.LOST, mCellNetworkAgent);
-        assertLength(1, mCm.getAllNetworks());
+        assertEquals(1, mCm.getAllNetworks().length);
 
         testFactory.unregister();
         mCm.unregisterNetworkCallback(cellNetworkCallback);
@@ -3287,7 +3287,7 @@
         assertNull(mCm.getActiveNetworkInfo());
 
         Network[] allNetworks = mCm.getAllNetworks();
-        assertLength(1, allNetworks);
+        assertEquals(1, allNetworks.length);
         Network network = allNetworks[0];
         NetworkCapabilities capabilities = mCm.getNetworkCapabilities(network);
         assertTrue(capabilities.hasTransport(TRANSPORT_LOWPAN));
@@ -3305,7 +3305,7 @@
         assertNull(mCm.getActiveNetwork());
         // TODO: getAllNetworkInfo is dirty and returns a non-empty array rght from the start
         // of this test. Fix it and uncomment the assert below.
-        //assertEmpty(mCm.getAllNetworkInfo());
+        //assertEquals(0, mCm.getAllNetworkInfo().length);
 
         // Disconnect lowpan.
         lowpanNetwork.disconnect();
@@ -3351,17 +3351,6 @@
         }
     }
 
-    private static <T> void assertEmpty(T[] ts) {
-        int length = ts.length;
-        assertEquals("expected empty array, but length was " + length, 0, length);
-    }
-
-    private static <T> void assertLength(int expected, T[] got) {
-        int length = got.length;
-        assertEquals(String.format("expected array of length %s, but length was %s for %s",
-                expected, length, Arrays.toString(got)), expected, length);
-    }
-
     /* test utilities */
     // TODO: eliminate all usages of sleepFor and replace by proper timeouts/waitForIdle.
     static private void sleepFor(int ms) {