Package com.google.common.collect.testing

Examples of com.google.common.collect.testing.TestStringSortedMapGenerator


  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTestSuite(ForwardingNavigableMapTest.class);
    suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
      @Override protected SortedMap<String, String> create(
          Entry<String, String>[] entries) {
        NavigableMap<String, String> map = new SafeTreeMap<String, String>();
        for (Entry<String, String> entry : entries) {
          map.put(entry.getKey(), entry.getValue());
View Full Code Here


  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(TreeBasedTableTest.class);
    suite.addTestSuite(TreeRowTest.class);
    suite.addTest(SortedMapTestSuiteBuilder
        .using(new TestStringSortedMapGenerator() {
          @Override protected SortedMap<String, String> create(
              Entry<String, String>[] entries) {
            TreeBasedTable<String, String, String> table =
                TreeBasedTable.create();
            table.put("a", "b", "c");
View Full Code Here

  public static TestSuite suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(SynchronizedNavigableMapTest.class);
    suite.addTest(
        NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
          private final Object mutex = new Integer(1);

          @Override protected SortedMap<String, String> create(
              Entry<String, String>[] entries) {
            NavigableMap<String, String> innermost =
View Full Code Here

  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTestSuite(ForwardingSortedMapTest.class);
    suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
      @Override protected SortedMap<String, String> create(
          Entry<String, String>[] entries) {
        SortedMap<String, String> map = new SafeTreeMap<String, String>();
        for (Entry<String, String> entry : entries) {
          map.put(entry.getKey(), entry.getValue());
        }
        return new StandardImplForwardingSortedMap<String, String>(map);
      }
    }).named("ForwardingSortedMap[SafeTreeMap] with no comparator and standard "
        + "implementations").withFeatures(CollectionSize.ANY,
        CollectionFeature.KNOWN_ORDER, MapFeature.ALLOWS_NULL_VALUES,
        MapFeature.GENERAL_PURPOSE, CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .createTestSuite());
    suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
      private final Comparator<String> comparator = NullsBeforeTwo.INSTANCE;

      @Override protected SortedMap<String, String> create(
          Entry<String, String>[] entries) {
        SortedMap<String, String> map =
            new SafeTreeMap<String, String>(comparator);
        for (Entry<String, String> entry : entries) {
          map.put(entry.getKey(), entry.getValue());
        }
        return new StandardImplForwardingSortedMap<String, String>(map);
      }
    }).named("ForwardingSortedMap[SafeTreeMap] with natural comparator and "
        + "standard implementations").withFeatures(CollectionSize.ANY,
        CollectionFeature.KNOWN_ORDER, MapFeature.ALLOWS_NULL_VALUES,
        MapFeature.ALLOWS_NULL_KEYS, MapFeature.ALLOWS_ANY_NULL_QUERIES,
        MapFeature.GENERAL_PURPOSE,
        CollectionFeature.SUPPORTS_ITERATOR_REMOVE).createTestSuite());
    suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
      @Override protected SortedMap<String, String> create(
          Entry<String, String>[] entries) {
        ImmutableSortedMap.Builder<String, String> builder =
            ImmutableSortedMap.naturalOrder();
        for (Entry<String, String> entry : entries) {
View Full Code Here

public class MapsCollectionTest extends TestCase {
  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTest(NavigableMapTestSuiteBuilder
        .using(new TestStringSortedMapGenerator() {
          @Override
          protected SortedMap<String, String> create(Entry<String, String>[] entries) {
            SafeTreeMap<String, String> map = new SafeTreeMap<String, String>();
            putEntries(map, entries);
            return Maps.unmodifiableNavigableMap(map);
View Full Code Here

    return suite;
  }
 
  static TestSuite filterSortedMapSuite() {
    TestSuite suite = new TestSuite("FilterSortedMap");
    suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
        @Override
        protected SortedMap<String, String> create(Entry<String, String>[] entries) {
          SortedMap<String, String> map = new NonNavigableSortedMap();
          putEntries(map, entries);
          map.putAll(ENTRIES_TO_FILTER);
         return Maps.filterKeys(map, FILTER_KEYS);
        }
      })
      .named("Maps.filterKeys[SortedMap, Predicate]")
      .withFeatures(
          MapFeature.ALLOWS_NULL_VALUES,
          MapFeature.GENERAL_PURPOSE,
          CollectionSize.ANY)
      .createTestSuite());
    suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
        @Override
        protected SortedMap<String, String> create(Entry<String, String>[] entries) {
          SortedMap<String, String> map = new NonNavigableSortedMap();
          putEntries(map, entries);
          map.putAll(ENTRIES_TO_FILTER);
          return Maps.filterValues(map, FILTER_VALUES);
        }
      })
      .named("Maps.filterValues[SortedMap, Predicate]")
      .withFeatures(
          MapFeature.ALLOWS_NULL_VALUES,
          MapFeature.GENERAL_PURPOSE,
          CollectionSize.ANY)
      .createTestSuite());
    suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
        @Override
        protected SortedMap<String, String> create(Entry<String, String>[] entries) {
          SortedMap<String, String> map = new NonNavigableSortedMap();
          putEntries(map, entries);
          map.putAll(ENTRIES_TO_FILTER);
View Full Code Here

    return suite;
  }
 
  static TestSuite filterNavigableMapSuite() {
    TestSuite suite = new TestSuite("FilterNavigableMap");
    suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
      @Override
      protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
        NavigableMap<String, String> map = new SafeTreeMap<String, String>();
        putEntries(map, entries);
        map.put("banana", "toast");
        map.put("eggplant", "spam");
        return Maps.filterKeys(map, FILTER_KEYS);
      }
    })
    .named("Maps.filterKeys[NavigableMap, Predicate]")
    .withFeatures(
        MapFeature.ALLOWS_NULL_VALUES,
        MapFeature.GENERAL_PURPOSE,
        CollectionSize.ANY)
        .createTestSuite());
    suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
      @Override
      protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
        NavigableMap<String, String> map = new SafeTreeMap<String, String>();
        putEntries(map, entries);
        map.put("banana", "toast");
        map.put("eggplant", "spam");
          return Maps.filterValues(map, FILTER_VALUES);
        }
      })
      .named("Maps.filterValues[NavigableMap, Predicate]")
      .withFeatures(
          MapFeature.ALLOWS_NULL_VALUES,
          MapFeature.GENERAL_PURPOSE,
          CollectionSize.ANY)
          .createTestSuite());
    suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
      @Override
      protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
        NavigableMap<String, String> map = new SafeTreeMap<String, String>();
        putEntries(map, entries);
        map.put("banana", "toast");
View Full Code Here

    return suite;
  }
 
  static TestSuite transformSortedMapSuite() {
    TestSuite suite = new TestSuite("TransformSortedMap");
    suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
        @Override
        protected SortedMap<String, String> create(Entry<String, String>[] entries) {
          SortedMap<String, String> map = new NonNavigableSortedMap();
          for (Entry<String, String> entry : entries) {
            map.put(entry.getKey(), encode(entry.getValue()));
          }
          return Maps.transformValues(map, DECODE_FUNCTION);
        }
      })
      .named("Maps.transformValues[SortedMap, Function]")
      .withFeatures(
          CollectionSize.ANY,
          CollectionFeature.KNOWN_ORDER,
          MapFeature.SUPPORTS_REMOVE,
          CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
      .createTestSuite());
    suite.addTest(SortedMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
        @Override
        protected SortedMap<String, String> create(Entry<String, String>[] entries) {
          SortedMap<String, String> map = new NonNavigableSortedMap();
          for (Entry<String, String> entry : entries) {
            map.put(entry.getKey(), encode(entry.getValue()));
View Full Code Here

    return suite;
  }
 
  static TestSuite transformNavigableMapSuite() {
    TestSuite suite = new TestSuite("TransformNavigableMap");
    suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
        @Override
        protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
          NavigableMap<String, String> map = new SafeTreeMap<String, String>();
          for (Entry<String, String> entry : entries) {
            map.put(entry.getKey(), encode(entry.getValue()));
          }
          return Maps.transformValues(map, DECODE_FUNCTION);
        }
      })
      .named("Maps.transformValues[NavigableMap, Function]")
      .withFeatures(
          CollectionSize.ANY,
          CollectionFeature.KNOWN_ORDER,
          MapFeature.SUPPORTS_REMOVE,
          CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
      .createTestSuite());
    suite.addTest(NavigableMapTestSuiteBuilder.using(new TestStringSortedMapGenerator() {
        @Override
        protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
          NavigableMap<String, String> map = new SafeTreeMap<String, String>();
          for (Entry<String, String> entry : entries) {
            map.put(entry.getKey(), encode(entry.getValue()));
View Full Code Here

TOP

Related Classes of com.google.common.collect.testing.TestStringSortedMapGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.