### Question:
StringShortHashtable implements Serializable { public StringShortHashtable() { this((short)3); } StringShortHashtable();  StringShortHashtable(int capacity); void put(String key, short value); short get(String key); boolean remove(String key); void removeAll(); boolean contains(String key); int size(); String[] getKeys();  }### Answer:
@Test public void testStringShortHashtable() { StringShortHashtable ht = new StringShortHashtable(); System.out.println("Test put method"); ht.put("A", (short)100); ht.put("B", (short)200); ht.put("C", (short)300); ht.put("D", (short)400); test(ht, "A", (short)100); test(ht, "B", (short)200); test(ht, "C", (short)300); test(ht, "D", (short)400); try { short value = ht.get("G"); Assert.fail("The value "+value+" was found at key "+ "G, but there should not have been a value there."); } catch(NoValueException ex) { } System.out.println("Test contains method"); testContains(ht, new String[]{"A","B","C","D"}, "Add"); System.out.println("Test size method"); if (ht.size() != 4) { Assert.fail("size should be 4, but it is "+ht.size()); } System.out.println("Test remove"); ht.remove("B"); if (ht.size() != 3) { Assert.fail("size should be 3, but it is "+ht.size()); } testContains(ht, new String[]{"A","C","D"}, "Remove"); System.out.println("Test removeAll"); ht.removeAll(); if (ht.size() != 0) { Assert.fail("size should be 0, but it is "+ht.size()); } testContains(ht,new String[]{}, "RemoveAll"); System.out.println("Test grow by adding 500 values"); for(int i=0;i<500;i++) { ht.put("LAB"+(100*i), (short)i); } for(int i= 0;i<50000;i++) { if (ht.contains("LAB"+i)) { if (i%100 != 0) { Assert.fail("hashtable contains key "+i+", but it shouldn't"); } } else { if (i%100 == 0) { Assert.fail("hashtable should contain key "+i+", but it doesn't"); } } } }