ListMultimapReplaceValuesTester.java revision 3c77433663281544363151bf284b0240dfd22a42
1/*
2 * Copyright (C) 2012 The Guava Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
12 * the License.
13 */
14
15package com.google.common.collect.testing.google;
16
17import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_PUT;
18import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_REMOVE;
19
20import com.google.common.annotations.GwtCompatible;
21import com.google.common.collect.ListMultimap;
22import com.google.common.collect.testing.features.MapFeature;
23
24import java.util.Arrays;
25import java.util.List;
26
27/**
28 * Testers for {@link ListMultimap#replaceValues(Object, Iterable)}.
29 *
30 * @author Louis Wasserman
31 */
32@GwtCompatible
33public class ListMultimapReplaceValuesTester<K, V> extends AbstractListMultimapTester<K, V> {
34  @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
35  public void testReplaceValuesPreservesOrder() {
36    @SuppressWarnings("unchecked")
37    List<V> values = Arrays.asList(
38        sampleValues().e3,
39        sampleValues().e1,
40        sampleValues().e4);
41
42    for (K k : sampleKeys()) {
43      resetContainer();
44      multimap().replaceValues(k, values);
45      assertGet(k, values);
46    }
47  }
48}
49