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

Class Class, % Method, % Line, %
TestStringBiMapGenerator 0% (0/1) 0% (0/7) 0% (0/17)


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.BiMap; 21 import com.google.common.collect.testing.Helpers; 22 import com.google.common.collect.testing.SampleElements; 23 import java.util.List; 24 import java.util.Map.Entry; 25  26 /** 27  * Implementation helper for {@link TestBiMapGenerator} for use with bimaps of strings. 28  * 29  * @author Chris Povirk 30  * @author Jared Levy 31  * @author George van den Driessche 32  * @author Louis Wasserman 33  */ 34 @GwtCompatible 35 public abstract class TestStringBiMapGenerator implements TestBiMapGenerator<String, String> { 36  37  @Override 38  public SampleElements<Entry<String, String>> samples() { 39  return new SampleElements<>( 40  Helpers.mapEntry("one", "January"), 41  Helpers.mapEntry("two", "February"), 42  Helpers.mapEntry("three", "March"), 43  Helpers.mapEntry("four", "April"), 44  Helpers.mapEntry("five", "May")); 45  } 46  47  @Override 48  public final BiMap<String, String> create(Object... entries) { 49  @SuppressWarnings("unchecked") 50  Entry<String, String>[] array = new Entry[entries.length]; 51  int i = 0; 52  for (Object o : entries) { 53  @SuppressWarnings("unchecked") 54  Entry<String, String> e = (Entry<String, String>) o; 55  array[i++] = e; 56  } 57  return create(array); 58  } 59  60  protected abstract BiMap<String, String> create(Entry<String, String>[] entries); 61  62  @Override 63  @SuppressWarnings("unchecked") 64  public final Entry<String, String>[] createArray(int length) { 65  return new Entry[length]; 66  } 67  68  @Override 69  public final String[] createKeyArray(int length) { 70  return new String[length]; 71  } 72  73  @Override 74  public final String[] createValueArray(int length) { 75  return new String[length]; 76  } 77  78  /** Returns the original element list, unchanged. */ 79  @Override 80  public Iterable<Entry<String, String>> order(List<Entry<String, String>> insertionOrder) { 81  return insertionOrder; 82  } 83 }