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

Class Class, % Method, % Line, %
TestStringSetMultimapGenerator 0% (0/1) 0% (0/10) 0% (0/20)


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 package com.google.common.collect.testing.google; 17  18 import com.google.common.annotations.GwtCompatible; 19 import com.google.common.collect.SetMultimap; 20 import com.google.common.collect.testing.Helpers; 21 import com.google.common.collect.testing.SampleElements; 22 import java.util.Collection; 23 import java.util.List; 24 import java.util.Map.Entry; 25  26 /** 27  * A skeleton generator for a {@code SetMultimap} implementation. 28  * 29  * @author Louis Wasserman 30  */ 31 @GwtCompatible 32 public abstract class TestStringSetMultimapGenerator 33  implements TestSetMultimapGenerator<String, String> { 34  35  @Override 36  public SampleElements<Entry<String, String>> samples() { 37  return new SampleElements<>( 38  Helpers.mapEntry("one", "January"), 39  Helpers.mapEntry("two", "February"), 40  Helpers.mapEntry("three", "March"), 41  Helpers.mapEntry("four", "April"), 42  Helpers.mapEntry("five", "May")); 43  } 44  45  @Override 46  public SampleElements<String> sampleKeys() { 47  return new SampleElements<>("one", "two", "three", "four", "five"); 48  } 49  50  @Override 51  public SampleElements<String> sampleValues() { 52  return new SampleElements<>("January", "February", "March", "April", "May"); 53  } 54  55  @Override 56  public Collection<String> createCollection(Iterable<? extends String> values) { 57  return Helpers.copyToSet(values); 58  } 59  60  @Override 61  public final SetMultimap<String, String> create(Object... entries) { 62  @SuppressWarnings("unchecked") 63  Entry<String, String>[] array = new Entry[entries.length]; 64  int i = 0; 65  for (Object o : entries) { 66  @SuppressWarnings("unchecked") 67  Entry<String, String> e = (Entry<String, String>) o; 68  array[i++] = e; 69  } 70  return create(array); 71  } 72  73  protected abstract SetMultimap<String, String> create(Entry<String, String>[] entries); 74  75  @Override 76  @SuppressWarnings("unchecked") 77  public final Entry<String, String>[] createArray(int length) { 78  return new Entry[length]; 79  } 80  81  @Override 82  public final String[] createKeyArray(int length) { 83  return new String[length]; 84  } 85  86  @Override 87  public final String[] createValueArray(int length) { 88  return new String[length]; 89  } 90  91  /** Returns the original element list, unchanged. */ 92  @Override 93  public Iterable<Entry<String, String>> order(List<Entry<String, String>> insertionOrder) { 94  return insertionOrder; 95  } 96 }