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.CollectionCreationTester.getCreateWithNullUnsupportedMethod;
20 import static com.google.common.collect.testing.testers.MapCreationTester.getCreateWithNullKeyUnsupportedMethod;
21 import static com.google.common.collect.testing.testers.MapEntrySetTester.getContainsEntryWithIncomparableKeyMethod;
22 import static com.google.common.collect.testing.testers.MapEntrySetTester.getContainsEntryWithIncomparableValueMethod;
23 import static com.google.common.collect.testing.testers.MapPutAllTester.getPutAllNullKeyUnsupportedMethod;
24 import static com.google.common.collect.testing.testers.MapPutTester.getPutNullKeyUnsupportedMethod;
25 
26 import junit.framework.Test;
27 import junit.framework.TestSuite;
28 
29 import java.lang.reflect.Method;
30 import java.util.Arrays;
31 import java.util.Collection;
32 import java.util.Map;
33 
34 /**
35  * Tests the {@link Map} implementations of {@link java.util}, suppressing
36  * tests that trip known OpenJDK 6 bugs.
37  *
38  * @author Kevin Bourrillion
39  */
40 public class OpenJdk6MapTests extends TestsForMapsInJavaUtil {
suite()41   public static Test suite() {
42     return new OpenJdk6MapTests().allTests();
43   }
44 
suppressForTreeMapNatural()45   @Override protected Collection<Method> suppressForTreeMapNatural() {
46     return Arrays.asList(
47         getPutNullKeyUnsupportedMethod(),
48         getPutAllNullKeyUnsupportedMethod(),
49         getCreateWithNullKeyUnsupportedMethod(),
50         getCreateWithNullUnsupportedMethod(), // for keySet
51         getContainsEntryWithIncomparableKeyMethod(),
52         getContainsEntryWithIncomparableValueMethod());
53   }
54 
55   @Override
suppressForConcurrentSkipListMap()56   protected Collection<Method> suppressForConcurrentSkipListMap() {
57     return Arrays.asList(
58         getContainsEntryWithIncomparableKeyMethod(),
59         getContainsEntryWithIncomparableValueMethod());
60   }
61 
testsForEnumMap()62   @Override public Test testsForEnumMap() {
63     // Do nothing.
64     // TODO: work around the reused-entry problem
65     // http://bugs.sun.com/view_bug.do?bug_id=6312706
66     return new TestSuite();
67   }
68 }
69