01: /*
02: (c) Copyright 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP, all rights reserved.
03: [See end of file]
04: $Id: TestCollectionFactory.java,v 1.6 2008/01/02 12:08:35 andy_seaborne Exp $
05: */
06: package com.hp.hpl.jena.util.test;
07:
08: import java.util.*;
09:
10: import junit.framework.TestSuite;
11:
12: import com.hp.hpl.jena.rdf.model.test.ModelTestBase;
13: import com.hp.hpl.jena.util.CollectionFactory;
14:
15: /**
16: TestHashUtils - test that the hash utility returns a map.
17: @author kers
18: */
19: public class TestCollectionFactory extends ModelTestBase {
20: public TestCollectionFactory(String name) {
21: super (name);
22: }
23:
24: public static TestSuite suite() {
25: return new TestSuite(TestCollectionFactory.class);
26: }
27:
28: public void testHashMapExists() {
29: Map map = CollectionFactory.createHashedMap();
30: assertInstanceOf(Map.class, map);
31: }
32:
33: public void testHashMapSized() {
34: Map map = CollectionFactory.createHashedMap(42);
35: assertInstanceOf(Map.class, map);
36: }
37:
38: public void testHashMapCopy() {
39: Map map = new HashMap();
40: map.put("here", "Bristol");
41: map.put("there", "Oxford");
42: Map copy = CollectionFactory.createHashedMap(map);
43: assertEquals(map, copy);
44: }
45:
46: public void testHashSetExists() {
47: Set set = CollectionFactory.createHashedSet();
48: assertInstanceOf(Set.class, set);
49: }
50:
51: public void testHashSetCopy() {
52: Set s = new HashSet();
53: s.add("jelly");
54: s.add("concrete");
55: Set copy = CollectionFactory.createHashedSet(s);
56: assertEquals(s, copy);
57: }
58: }
59:
60: /*
61: (c) Copyright 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
62: All rights reserved.
63:
64: Redistribution and use in source and binary forms, with or without
65: modification, are permitted provided that the following conditions
66: are met:
67:
68: 1. Redistributions of source code must retain the above copyright
69: notice, this list of conditions and the following disclaimer.
70:
71: 2. Redistributions in binary form must reproduce the above copyright
72: notice, this list of conditions and the following disclaimer in the
73: documentation and/or other materials provided with the distribution.
74:
75: 3. The name of the author may not be used to endorse or promote products
76: derived from this software without specific prior written permission.
77:
78: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
79: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
80: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
81: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
82: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
83: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
84: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
85: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
86: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
87: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88: */
|