1 /* 2 * Copyright (C) 2008 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.content.cts; 18 19 import android.content.Intent; 20 import android.content.Intent.FilterComparison; 21 import android.test.AndroidTestCase; 22 23 public class Intent_FilterComparisonTest extends AndroidTestCase { 24 25 FilterComparison mFilterComparison; 26 Intent mIntent; 27 28 @Override 29 protected void setUp() throws Exception { 30 super.setUp(); 31 mFilterComparison = null; 32 mIntent = new Intent(); 33 } 34 35 public void testConstructor() { 36 mFilterComparison = null; 37 // new the FilterComparison instance 38 mFilterComparison = new Intent.FilterComparison(mIntent); 39 assertNotNull(mFilterComparison); 40 41 } 42 43 public void testHashCode() { 44 mFilterComparison = new Intent.FilterComparison(mIntent); 45 assertNotNull(mFilterComparison); 46 assertEquals(mIntent.filterHashCode(), mFilterComparison.hashCode()); 47 } 48 49 public void testEquals() { 50 mFilterComparison = new Intent.FilterComparison(mIntent); 51 assertNotNull(mFilterComparison); 52 FilterComparison target = new Intent.FilterComparison(mIntent); 53 assertNotNull(mFilterComparison); 54 assertTrue(mFilterComparison.equals(target)); 55 target = new Intent.FilterComparison(new Intent("test")); 56 assertFalse(mFilterComparison.equals(target)); 57 } 58 59 public void testGetIntent() { 60 mFilterComparison = new Intent.FilterComparison(mIntent); 61 assertNotNull(mFilterComparison); 62 assertTrue(mFilterComparison.getIntent().equals(mIntent)); 63 } 64 65 } 66