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

Class Class, % Method, % Line, %
MultimapContainsEntryTester 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.CollectionSize.ZERO; 20 import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_KEYS; 21 import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_KEY_QUERIES; 22 import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_VALUES; 23 import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_VALUE_QUERIES; 24  25 import com.google.common.annotations.GwtCompatible; 26 import com.google.common.collect.Multimap; 27 import com.google.common.collect.testing.features.CollectionSize; 28 import com.google.common.collect.testing.features.MapFeature; 29 import org.junit.Ignore; 30  31 /** 32  * Tester for {@link Multimap#containsEntry}. 33  * 34  * @author Louis Wasserman 35  */ 36 @GwtCompatible 37 @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. 38 public class MultimapContainsEntryTester<K, V> 39  extends AbstractMultimapTester<K, V, Multimap<K, V>> { 40  @CollectionSize.Require(absent = ZERO) 41  public void testContainsEntryYes() { 42  assertTrue(multimap().containsEntry(k0(), v0())); 43  } 44  45  public void testContainsEntryNo() { 46  assertFalse(multimap().containsEntry(k3(), v3())); 47  } 48  49  public void testContainsEntryAgreesWithGet() { 50  for (K k : sampleKeys()) { 51  for (V v : sampleValues()) { 52  assertEquals(multimap().get(k).contains(v), multimap().containsEntry(k, v)); 53  } 54  } 55  } 56  57  @CollectionSize.Require(absent = ZERO) 58  @MapFeature.Require({ALLOWS_NULL_KEYS, ALLOWS_NULL_VALUES}) 59  public void testContainsEntryNullYes() { 60  initMultimapWithNullKeyAndValue(); 61  assertTrue(multimap().containsEntry(null, null)); 62  } 63  64  @MapFeature.Require({ALLOWS_NULL_KEY_QUERIES, ALLOWS_NULL_VALUE_QUERIES}) 65  public void testContainsEntryNullNo() { 66  assertFalse(multimap().containsEntry(null, null)); 67  } 68  69  @MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES) 70  public void testContainsEntryNullDisallowedBecauseKeyQueriesDisallowed() { 71  try { 72  multimap().containsEntry(null, v3()); 73  fail("Expected NullPointerException"); 74  } catch (NullPointerException expected) { 75  // success 76  } 77  } 78  79  @MapFeature.Require(absent = ALLOWS_NULL_VALUE_QUERIES) 80  public void testContainsEntryNullDisallowedBecauseValueQueriesDisallowed() { 81  try { 82  multimap().containsEntry(k3(), null); 83  fail("Expected NullPointerException"); 84  } catch (NullPointerException expected) { 85  // success 86  } 87  } 88 }