Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2013 The Guava Authors
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package com.google.common.collect.testing.testers;
 
 import static com.google.common.collect.testing.features.CollectionFeature.SUPPORTS_ITERATOR_REMOVE;
 import static com.google.common.collect.testing.features.CollectionSize.ONE;
 import static com.google.common.collect.testing.features.CollectionSize.ZERO;
 import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_KEYS;
 import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_QUERIES;
 import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_VALUES;
 
 
 import java.util.Set;

Tests java.util.Map.entrySet().

Parameters:
<K> The key type of the map implementation under test.
<V> The value type of the map implementation under test.
Author(s):
Louis Wasserman
 
 public class MapEntrySetTester<K, V> extends AbstractMapTester<K, V> {
   private enum IncomparableType {
     INSTANCE;
   }
   
   public void testEntrySetIteratorRemove() {
     Set<Entry<K, V>> entrySet = getMap().entrySet();
     Iterator<Entry<K, V>> entryItr = entrySet.iterator();
     assertEquals(.entryItr.next());
     entryItr.remove();
     assertTrue(getMap().isEmpty());
     assertFalse(entrySet.contains(.));
   }
 
     assertFalse(getMap()
   }
 
     assertFalse(getMap()
         .entrySet().contains(Helpers.mapEntry(..getKey(), .)));
   }
   
   public void testContainsEntryWithNullKeyAbsent() {
     assertFalse(getMap()
         .entrySet().contains(Helpers.mapEntry(null..getValue())));
   }
   
   @CollectionSize.Require(absent = )
   public void testContainsEntryWithNullKeyPresent() {
     assertTrue(getMap()
         .entrySet().contains(Helpers.mapEntry(nullgetValueForNullKey())));
   }
   
     assertFalse(getMap()
         .entrySet().contains(Helpers.mapEntry(..getKey(), null)));
   }
   
   @CollectionSize.Require(absent = )
     assertTrue(getMap()
         .entrySet().contains(Helpers.mapEntry(getKeyForNullValue(), null)));
   }
  
  @GwtIncompatible("reflection")
    return Helpers.getMethod(MapEntrySetTester.class"testContainsEntryWithIncomparableKey");
  }
  
  @GwtIncompatible("reflection")
    return Helpers.getMethod(MapEntrySetTester.class"testContainsEntryWithIncomparableValue");
  }
New to GrepCode? Check out our FAQ X