Coverage Summary for Class: ConcurrentMapRemoveTester (com.google.common.collect.testing.testers)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| ConcurrentMapRemoveTester | 0% (0/1) | 0% (0/10) | 0% (0/35) |
1 /* 2 * Copyright (C) 2015 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.testers; 18 19 import static com.google.common.collect.testing.features.CollectionSize.ZERO; 20 import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_KEY_QUERIES; 21 import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_VALUE_QUERIES; 22 import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_REMOVE; 23 24 import com.google.common.annotations.GwtCompatible; 25 import com.google.common.collect.testing.AbstractMapTester; 26 import com.google.common.collect.testing.features.CollectionSize; 27 import com.google.common.collect.testing.features.MapFeature; 28 import java.util.concurrent.ConcurrentMap; 29 import org.junit.Ignore; 30 31 /** 32 * Tester for {@link ConcurrentMap#remove}. Can't be invoked directly; please see {@link 33 * com.google.common.collect.testing.ConcurrentMapTestSuiteBuilder}. 34 * 35 * @author Louis Wasserman 36 */ 37 @GwtCompatible 38 @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. 39 public class ConcurrentMapRemoveTester<K, V> extends AbstractMapTester<K, V> { 40 @Override 41 protected ConcurrentMap<K, V> getMap() { 42 return (ConcurrentMap<K, V>) super.getMap(); 43 } 44 45 @MapFeature.Require(SUPPORTS_REMOVE) 46 @CollectionSize.Require(absent = ZERO) 47 public void testRemove_supportedPresent() { 48 assertTrue(getMap().remove(k0(), v0())); 49 expectMissing(e0()); 50 } 51 52 @MapFeature.Require(SUPPORTS_REMOVE) 53 public void testRemove_supportedPresentKeyWrongValue() { 54 assertFalse(getMap().remove(k0(), v3())); 55 expectUnchanged(); 56 } 57 58 @MapFeature.Require(SUPPORTS_REMOVE) 59 public void testRemove_supportedWrongKeyPresentValue() { 60 assertFalse(getMap().remove(k3(), v0())); 61 expectUnchanged(); 62 } 63 64 @MapFeature.Require(SUPPORTS_REMOVE) 65 public void testRemove_supportedAbsentKeyAbsentValue() { 66 assertFalse(getMap().remove(k3(), v3())); 67 expectUnchanged(); 68 } 69 70 @MapFeature.Require(value = SUPPORTS_REMOVE, absent = ALLOWS_NULL_KEY_QUERIES) 71 public void testRemove_nullKeyQueriesUnsupported() { 72 try { 73 assertFalse(getMap().remove(null, v3())); 74 } catch (NullPointerException tolerated) { 75 // since the operation would be a no-op, the exception is not required 76 } 77 expectUnchanged(); 78 } 79 80 @MapFeature.Require(value = SUPPORTS_REMOVE, absent = ALLOWS_NULL_VALUE_QUERIES) 81 public void testRemove_nullValueQueriesUnsupported() { 82 try { 83 assertFalse(getMap().remove(k3(), null)); 84 } catch (NullPointerException tolerated) { 85 // since the operation would be a no-op, the exception is not required 86 } 87 expectUnchanged(); 88 } 89 90 @MapFeature.Require(absent = SUPPORTS_REMOVE) 91 @CollectionSize.Require(absent = ZERO) 92 public void testRemove_unsupportedPresent() { 93 try { 94 getMap().remove(k0(), v0()); 95 fail("Expected UnsupportedOperationException"); 96 } catch (UnsupportedOperationException expected) { 97 } 98 expectUnchanged(); 99 } 100 101 @MapFeature.Require(absent = SUPPORTS_REMOVE) 102 public void testRemove_unsupportedAbsent() { 103 try { 104 assertFalse(getMap().remove(k0(), v3())); 105 } catch (UnsupportedOperationException tolerated) { 106 // since the operation would be a no-op, the exception is not required 107 } 108 expectUnchanged(); 109 } 110 }