Home | History | Annotate | Download | only in testing
      1 /*
      2  * Copyright (C) 2009 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;
     18 
     19 import static com.google.common.collect.testing.testers.CollectionToArrayTester.getToArrayIsPlainObjectArrayMethod;
     20 import static com.google.common.collect.testing.testers.ListAddTester.getAddSupportedNullPresentMethod;
     21 import static com.google.common.collect.testing.testers.ListListIteratorTester.getListIteratorFullyModifiableMethod;
     22 import static com.google.common.collect.testing.testers.ListSetTester.getSetNullSupportedMethod;
     23 import static com.google.common.collect.testing.testers.ListSubListTester.getSubListOriginalListSetAffectsSubListLargeListMethod;
     24 import static com.google.common.collect.testing.testers.ListSubListTester.getSubListOriginalListSetAffectsSubListMethod;
     25 import static com.google.common.collect.testing.testers.ListSubListTester.getSubListSubListRemoveAffectsOriginalLargeListMethod;
     26 
     27 import com.google.common.collect.testing.testers.CollectionAddTester;
     28 import com.google.common.collect.testing.testers.ListAddAtIndexTester;
     29 
     30 import junit.framework.Test;
     31 
     32 import java.lang.reflect.Method;
     33 import java.util.Arrays;
     34 import java.util.Collection;
     35 import java.util.List;
     36 
     37 /**
     38  * Tests the {@link List} implementations of {@link java.util}, suppressing
     39  * tests that trip known OpenJDK 6 bugs.
     40  *
     41  * @author Kevin Bourrillion
     42  */
     43 public class OpenJdk6ListTests extends TestsForListsInJavaUtil {
     44   public static Test suite() {
     45     return new OpenJdk6ListTests().allTests();
     46   }
     47 
     48   @Override protected Collection<Method> suppressForArraysAsList() {
     49     return Arrays.asList(
     50         getToArrayIsPlainObjectArrayMethod());
     51   }
     52 
     53   @Override protected Collection<Method> suppressForCopyOnWriteArrayList() {
     54     return Arrays.asList(
     55         getSubListOriginalListSetAffectsSubListMethod(),
     56         getSubListOriginalListSetAffectsSubListLargeListMethod(),
     57         getSubListSubListRemoveAffectsOriginalLargeListMethod(),
     58         getListIteratorFullyModifiableMethod());
     59   }
     60 
     61   @Override protected Collection<Method> suppressForCheckedList() {
     62     return Arrays.asList(
     63         CollectionAddTester.getAddNullSupportedMethod(),
     64         getAddSupportedNullPresentMethod(),
     65         ListAddAtIndexTester.getAddNullSupportedMethod(),
     66         getSetNullSupportedMethod());
     67   }
     68 }
     69