KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > trove > TIdentityHashMapTest


1 ///////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 2001-2006, Eric D. Friedman All Rights Reserved.
3
//
4
// This library is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU Lesser General Public
6
// License as published by the Free Software Foundation; either
7
// version 2.1 of the License, or (at your option) any later version.
8
//
9
// This library is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public
15
// License along with this program; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
///////////////////////////////////////////////////////////////////////////////
18

19 package gnu.trove;
20
21
22 /**
23  *
24  * Created: Sat Aug 17 11:22:30 2002
25  *
26  * @author Eric Friedman
27  * @version $Id: TIdentityHashMapTest.java,v 1.1 2006/11/10 23:28:00 robeden Exp $
28  */

29
30 public class TIdentityHashMapTest extends THashMapTest {
31     
32     public TIdentityHashMapTest(String JavaDoc name) {
33         super(name);
34     }
35
36     public void setUp() throws Exception JavaDoc {
37         super.setUp();
38         map = new THashMap(new TObjectIdentityHashingStrategy());
39         count = 0;
40     }
41
42     public void testIdentityHash() throws Exception JavaDoc {
43         Integer JavaDoc i1, i2;
44         i1 = new Integer JavaDoc(1);
45         i2 = new Integer JavaDoc(1);
46
47         map.put(i1,i1);
48         assertTrue(map.containsKey(i1));
49         assertTrue(! map.containsKey(i2));
50     }
51
52     public void testBadlyWrittenKey() {
53        ; // this test not applicable in identity hashing
54
}
55 } // TIdentityHashMapTests
56
Popular Tags