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

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