Пример #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);
 }