public void testRemove() {
int[] keys = {1138, 42, 86, 99, 101, 727, 117};
Long[] vals = new Long[keys.length];
TIntLongMap raw_map = new TIntLongHashMap();
for ( int i = 0; i < keys.length; i++ ) {
vals[i] = Long.valueOf( keys[i] * 2 );
raw_map.put( keys[i], vals[i] );
}
Map<Integer,Long> map = TDecorators.wrap( raw_map );
assertEquals( keys.length, map.size() );
for ( int i = 0; i < keys.length; i++ ) {
assertEquals( vals[i], map.get( keys[i] ) );
}
assertEquals( vals[0], map.remove( keys[0] ) );
assertEquals( vals[3], map.remove( keys[3] ) );
assertNull( map.remove( keys[0] ) );
assertEquals( vals[5], map.remove( keys[5] ) );
assertNull( map.remove( 11010110 ) );
assertNull( map.get( 1138 ) );
//noinspection SuspiciousMethodCalls
assertNull( map.get( Integer.valueOf( 1138 ) ) );
assertNull( map.get( null ) );
Long null_value = Long.valueOf( 2112 );
map.put( null, null_value );
assertEquals( null_value.longValue(), raw_map.get( raw_map.getNoEntryKey() ) );
assertTrue( map.containsKey( null ) );
Long value = map.get( null );
assertEquals( "value: " + value, null_value, value );
assertEquals( null_value, map.remove( null ) );
assertFalse( map.containsKey( null ) );