1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
12 import java
.util
.Hashtable
;
16 * This is a test for {@link Hashtable}.
20 public class TestHashtable
24 * Initializes the test using the base map.
28 public TestHashtable()
30 this(new Hashtable
<Integer
, String
>());
34 * Initializes the test using the given map.
36 * @param __m The map to use.
37 * @throws NullPointerException On null arguments.
40 public TestHashtable(Map
<Integer
, String
> __m
)
41 throws NullPointerException
53 // Run basic HashMap test
56 // Initialize a map to work with
57 Map
<Integer
, String
> map
= this.map
;
59 // Null key should fail
60 boolean nullkey
= false;
63 map
.put(null, "Hiya!");
65 catch (NullPointerException e
)
69 this.secondary("nullkey", nullkey
);
71 // Null value should fail
72 boolean nullval
= false;
77 catch (NullPointerException e
)
81 this.secondary("nullval", nullval
);
83 // Cannot set values via the iterator either
84 Map
.Entry
<Integer
, String
> ent
= map
.entrySet().iterator().next();
85 boolean nullset
= false;
90 catch (NullPointerException e
)
94 this.secondary("nullset", nullset
);