• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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.nfc;
18 
19 import static com.google.common.truth.Truth.assertThat;
20 
21 import static org.mockito.Mockito.mock;
22 
23 import androidx.test.ext.junit.runners.AndroidJUnit4;
24 import androidx.test.filters.SmallTest;
25 
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.junit.runner.RunWith;
30 
31 import java.util.ArrayList;
32 import java.util.List;
33 
34 @SmallTest
35 @RunWith(AndroidJUnit4.class)
36 public class NfcAntennaInfoTest {
37     private NfcAntennaInfo mNfcAntennaInfo;
38 
39 
40     @Before
setUp()41     public void setUp() {
42         AvailableNfcAntenna availableNfcAntenna = mock(AvailableNfcAntenna.class);
43         List<AvailableNfcAntenna> antennas = new ArrayList<>();
44         antennas.add(availableNfcAntenna);
45         mNfcAntennaInfo = new NfcAntennaInfo(1, 1, false, antennas);
46     }
47 
48     @After
tearDown()49     public void tearDown() {
50     }
51 
52     @Test
testGetDeviceHeight()53     public void testGetDeviceHeight() {
54         int height = mNfcAntennaInfo.getDeviceHeight();
55         assertThat(height).isEqualTo(1);
56     }
57 
58     @Test
testGetDeviceWidth()59     public void testGetDeviceWidth() {
60         int width = mNfcAntennaInfo.getDeviceWidth();
61         assertThat(width).isEqualTo(1);
62     }
63 
64     @Test
testIsDeviceFoldable()65     public void testIsDeviceFoldable() {
66         boolean foldable = mNfcAntennaInfo.isDeviceFoldable();
67         assertThat(foldable).isFalse();
68     }
69 
70     @Test
testGetAvailableNfcAntennas()71     public void testGetAvailableNfcAntennas() {
72         List<AvailableNfcAntenna> antennas = mNfcAntennaInfo.getAvailableNfcAntennas();
73         assertThat(antennas).isNotNull();
74         assertThat(antennas.size()).isEqualTo(1);
75     }
76 
77 }
78