Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2007 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.ALLOWS_NULL_QUERIES;
 import static com.google.common.collect.testing.features.CollectionFeature.ALLOWS_NULL_VALUES;
 import static com.google.common.collect.testing.features.CollectionSize.ZERO;
 
 
A generic JUnit test which tests containsAll() operations on a collection. Can't be invoked directly; please see com.google.common.collect.testing.CollectionTestSuiteBuilder.

Author(s):
Kevin Bourrillion
Chris Povirk
 
 @SuppressWarnings("unchecked"// too many "unchecked generic array creations"
 public class CollectionContainsAllTester<E>
     extends AbstractCollectionTester<E> {
   public void testContainsAll_empty() {
     assertTrue("containsAll(empty) should return true",
         .containsAll(MinimalCollection.of()));
   }
 
   @CollectionSize.Require(absent = )
   public void testContainsAll_subset() {
     assertTrue("containsAll(subset) should return true",
         .containsAll(MinimalCollection.of(.)));
   }
 
   public void testContainsAll_sameElements() {
     assertTrue("containsAll(sameElements) should return true",
         .containsAll(MinimalCollection.of(createSamplesArray())));
   }
 
   @SuppressWarnings("ModifyingCollectionWithItself")
   public void testContainsAll_self() {
     assertTrue("containsAll(this) should return true",
         .containsAll());
   }
 
   public void testContainsAll_partialOverlap() {
     assertFalse("containsAll(partialOverlap) should return false",
         .containsAll(MinimalCollection.of(..)));
   }
 
   public void testContainsAll_disjoint() {
     assertFalse("containsAll(disjoint) should return false",
         .containsAll(MinimalCollection.of(.)));
   }
 
   public void testContainsAll_nullNotAllowed() {
     try {
       assertFalse(.containsAll(MinimalCollection.of((E) null)));
     } catch (NullPointerException tolerated) {}
   }
 
   public void testContainsAll_nullAllowed() {
     assertFalse(.containsAll(MinimalCollection.of((E) null)));
   }
 
   @CollectionSize.Require(absent = )
   public void testContainsAll_nullPresent() {
     assertTrue(.containsAll(MinimalCollection.of((E) null)));
   }
 
   public void testContainsAll_wrongType() {
     Collection<WrongTypewrong = MinimalCollection.of(.);
     try {
       assertFalse("containsAll(wrongType) should return false or throw",
           .containsAll(wrong));
    } catch (ClassCastException tolerated) {
    }
  }
New to GrepCode? Check out our FAQ X