示例#1
0
 @Test
 public void getNulls() {
   // put some nulls (according to the test putNulls)
   map.put(null, 1l); // put
   map.put(null, 3l); // not put
   map.put(1, null); // put
   map.put(3, null); // put
   // check
   assertEquals((Long) 1l, map.get(null));
   assertEquals(null, map.get(1));
   assertEquals(null, map.get(3));
 }
示例#2
0
 @Test
 public void getValues() {
   long[] testArray = new long[16];
   long curValue;
   // put values
   for (int i = 0; i < 16; i++) {
     curValue = random.nextLong();
     map.put(i, curValue);
     testArray[i] = curValue;
   }
   // check
   for (int i = 0; i < 16; i++) {
     assertEquals((Long) testArray[i], map.get(i));
   }
 }
示例#3
0
 @Test(expected = NoSuchElementException.class)
 public void getNotExistsElement() {
   map.put(1, 1l);
   map.get(0);
 }
示例#4
0
 // get
 @Test(expected = NullPointerException.class)
 public void getFromEmptyMap() {
   map.get(0);
 }