Merge "getWifiActivityEnergyInfoAsync: throw NPE instead of IAE"
This commit is contained in:
committed by
Android (Google) Code Review
commit
6867d35756
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user