Home | History | Annotate | Download | only in data
      1 /*
      2  * Copyright (C) 2018 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 com.android.internal.telephony.uicc.euicc.data;
     18 
     19 import static org.junit.Assert.assertEquals;
     20 import static org.junit.Assert.assertFalse;
     21 import static org.junit.Assert.assertNotEquals;
     22 import static org.junit.Assert.assertTrue;
     23 
     24 import android.telephony.euicc.EuiccNotification;
     25 
     26 import org.junit.Test;
     27 
     28 public class EuiccNotificationTest {
     29     @Test
     30     public void testEqualsHashCode() {
     31         EuiccNotification n =
     32                 new EuiccNotification(1, "g.co", EuiccNotification.EVENT_DELETE, new byte[]{1});
     33         assertTrue(n.equals(n));
     34         assertFalse(n.equals(new Object()));
     35 
     36         EuiccNotification t = null;
     37         assertFalse(n.equals(t));
     38 
     39         t = new EuiccNotification(1, "g.co", EuiccNotification.EVENT_DELETE, new byte[]{1});
     40         assertTrue(n.equals(t));
     41         assertEquals(n.hashCode(), t.hashCode());
     42 
     43         t = new EuiccNotification(2, "g.co", EuiccNotification.EVENT_DELETE, new byte[]{1});
     44         assertFalse(n.equals(t));
     45         assertNotEquals(n.hashCode(), t.hashCode());
     46 
     47         t = new EuiccNotification(1, "x.co", EuiccNotification.EVENT_DELETE, new byte[]{1});
     48         assertFalse(n.equals(t));
     49         assertNotEquals(n.hashCode(), t.hashCode());
     50 
     51         t = new EuiccNotification(1, "g.co", 0, new byte[]{1});
     52         assertFalse(n.equals(t));
     53         assertNotEquals(n.hashCode(), t.hashCode());
     54 
     55         t = new EuiccNotification(1, "g.co", EuiccNotification.EVENT_DELETE, null);
     56         assertFalse(n.equals(t));
     57         assertNotEquals(n.hashCode(), t.hashCode());
     58     }
     59 }
     60