1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.net; 18 19 import static com.android.testutils.DevSdkIgnoreRuleKt.SC_V2; 20 import static com.android.testutils.ParcelUtils.assertParcelingIsLossless; 21 22 import static org.junit.Assert.assertEquals; 23 24 import androidx.test.filters.SmallTest; 25 26 import com.android.testutils.DevSdkIgnoreRule; 27 import com.android.testutils.DevSdkIgnoreRunner; 28 29 import org.junit.Test; 30 import org.junit.runner.RunWith; 31 32 @DevSdkIgnoreRule.IgnoreUpTo(SC_V2) // TODO: Use to Build.VERSION_CODES.SC_V2 when available 33 @RunWith(DevSdkIgnoreRunner.class) 34 @SmallTest 35 public class EthernetNetworkManagementExceptionTest { 36 private static final String ERROR_MESSAGE = "Test error message"; 37 38 @Test testEthernetNetworkManagementExceptionParcelable()39 public void testEthernetNetworkManagementExceptionParcelable() { 40 final EthernetNetworkManagementException e = 41 new EthernetNetworkManagementException(ERROR_MESSAGE); 42 43 assertParcelingIsLossless(e); 44 } 45 46 @Test testEthernetNetworkManagementExceptionHasExpectedErrorMessage()47 public void testEthernetNetworkManagementExceptionHasExpectedErrorMessage() { 48 final EthernetNetworkManagementException e = 49 new EthernetNetworkManagementException(ERROR_MESSAGE); 50 51 assertEquals(ERROR_MESSAGE, e.getMessage()); 52 } 53 } 54