Merge "getWifiActivityEnergyInfoAsync: throw NPE instead of IAE"

This commit is contained in:
TreeHugger Robot
2020-02-06 22:17:11 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 4 deletions

View File

@@ -2625,8 +2625,8 @@ public class WifiManager {
public void getWifiActivityEnergyInfoAsync(
@NonNull @CallbackExecutor Executor executor,
@NonNull OnWifiActivityEnergyInfoListener listener) {
if (executor == null) throw new IllegalArgumentException("executor cannot be null");
if (listener == null) throw new IllegalArgumentException("listener cannot be null");
Objects.requireNonNull(executor, "executor cannot be null");
Objects.requireNonNull(listener, "listener cannot be null");
try {
mService.getWifiActivityEnergyInfoAsync(
new OnWifiActivityEnergyInfoProxy(executor, listener));

View File

@@ -1867,7 +1867,7 @@ public class WifiManagerTest {
* Tests that passing a null Executor to {@link WifiManager#getWifiActivityEnergyInfoAsync}
* throws an exception.
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = NullPointerException.class)
public void testGetWifiActivityInfoNullExecutor() throws Exception {
mWifiManager.getWifiActivityEnergyInfoAsync(null, mOnWifiActivityEnergyInfoListener);
}
@@ -1876,7 +1876,7 @@ public class WifiManagerTest {
* Tests that passing a null listener to {@link WifiManager#getWifiActivityEnergyInfoAsync}
* throws an exception.
*/
@Test(expected = IllegalArgumentException.class)
@Test(expected = NullPointerException.class)
public void testGetWifiActivityInfoNullListener() throws Exception {
mWifiManager.getWifiActivityEnergyInfoAsync(mExecutor, null);
}