Coverage Summary for Class: BiMapRemoveTester (com.google.common.collect.testing.google)

Class Class, % Method, % Line, %
BiMapRemoveTester 0% (0/1) 0% (0/8) 0% (0/26)


1 /* 2  * Copyright (C) 2012 The Guava Authors 3  * 4  * Licensed under the Apache License, Version 2.0 (the "License"); 5  * you may not use this file except in compliance with the License. 6  * You may obtain a copy of the License at 7  * 8  * http://www.apache.org/licenses/LICENSE-2.0 9  * 10  * Unless required by applicable law or agreed to in writing, software 11  * distributed under the License is distributed on an "AS IS" BASIS, 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13  * See the License for the specific language governing permissions and 14  * limitations under the License. 15  */ 16  17 package com.google.common.collect.testing.google; 18  19 import static com.google.common.collect.testing.features.CollectionFeature.SUPPORTS_ITERATOR_REMOVE; 20 import static com.google.common.collect.testing.features.CollectionSize.ZERO; 21 import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_REMOVE; 22  23 import com.google.common.annotations.GwtCompatible; 24 import com.google.common.collect.testing.features.CollectionFeature; 25 import com.google.common.collect.testing.features.CollectionSize; 26 import com.google.common.collect.testing.features.MapFeature; 27 import java.util.Iterator; 28 import org.junit.Ignore; 29  30 /** 31  * Tester for {@code BiMap.remove}. 32  * 33  * @author Louis Wasserman 34  */ 35 @GwtCompatible 36 @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. 37 public class BiMapRemoveTester<K, V> extends AbstractBiMapTester<K, V> { 38  @SuppressWarnings("unchecked") 39  @MapFeature.Require(SUPPORTS_REMOVE) 40  @CollectionSize.Require(absent = ZERO) 41  public void testRemoveKeyRemovesFromInverse() { 42  getMap().remove(k0()); 43  expectMissing(e0()); 44  } 45  46  @SuppressWarnings("unchecked") 47  @MapFeature.Require(SUPPORTS_REMOVE) 48  @CollectionSize.Require(absent = ZERO) 49  public void testRemoveKeyFromKeySetRemovesFromInverse() { 50  getMap().keySet().remove(k0()); 51  expectMissing(e0()); 52  } 53  54  @SuppressWarnings("unchecked") 55  @MapFeature.Require(SUPPORTS_REMOVE) 56  @CollectionSize.Require(absent = ZERO) 57  public void testRemoveFromValuesRemovesFromInverse() { 58  getMap().values().remove(v0()); 59  expectMissing(e0()); 60  } 61  62  @SuppressWarnings("unchecked") 63  @MapFeature.Require(SUPPORTS_REMOVE) 64  @CollectionSize.Require(absent = ZERO) 65  public void testRemoveFromInverseRemovesFromForward() { 66  getMap().inverse().remove(v0()); 67  expectMissing(e0()); 68  } 69  70  @SuppressWarnings("unchecked") 71  @MapFeature.Require(SUPPORTS_REMOVE) 72  @CollectionSize.Require(absent = ZERO) 73  public void testRemoveFromInverseKeySetRemovesFromForward() { 74  getMap().inverse().keySet().remove(v0()); 75  expectMissing(e0()); 76  } 77  78  @SuppressWarnings("unchecked") 79  @MapFeature.Require(SUPPORTS_REMOVE) 80  @CollectionSize.Require(absent = ZERO) 81  public void testRemoveFromInverseValuesRemovesFromInverse() { 82  getMap().inverse().values().remove(k0()); 83  expectMissing(e0()); 84  } 85  86  @CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE) 87  @CollectionSize.Require(absent = ZERO) 88  public void testKeySetIteratorRemove() { 89  int initialSize = getNumElements(); 90  Iterator<K> iterator = getMap().keySet().iterator(); 91  iterator.next(); 92  iterator.remove(); 93  assertEquals(initialSize - 1, getMap().size()); 94  assertEquals(initialSize - 1, getMap().inverse().size()); 95  } 96 }