Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
    package org.mapdb;
    
    /*
     *  Licensed to the Apache Software Foundation (ASF) under one or more
     *  contributor license agreements.  See the NOTICE file distributed with
     *  this work for additional information regarding copyright ownership.
     *  The ASF licenses this file to You under the Apache License, Version 2.0
     *  (the "License"); you may not use this file except in compliance with
     *  the License.  You may obtain a copy of the License at
    *
    *     http://www.apache.org/licenses/LICENSE-2.0
    *
    *  Unless required by applicable law or agreed to in writing, software
    *  distributed under the License is distributed on an "AS IS" BASIS,
    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    *  See the License for the specific language governing permissions and
    *  limitations under the License.
    */
   
   
   import java.io.Serializable;
   import java.util.*;
   import java.util.Map.Entry;
   
   
   // 
   public class TreeMapExtendTest extends TestCase {
   
   
       // Regression for Harmony-1026
       public static class MockComparator<T extends Comparable<T>> implements
               Comparator<T>, Serializable {
   
           public int compare(T o1, T o2) {
               if (o1 == o2) {
                   return 0;
               }
               if (null == o1 || null == o2) {
                   return -1;
               }
               T c1 = o1;
               T c2 = o2;
               return c1.compareTo(c2);
           }
       }
   
       TreeMap tm;
   
       TreeMap tm_comparator;
   
       SortedMap subMap_default;
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
       Object objArray[] = new Object[1000];
   
       public void test_TreeMap_Constructor_Default() {
           TreeMap treeMap = new TreeMap();
           assertTrue(treeMap.isEmpty());
           assertNull(treeMap.comparator());
           assertEquals(0, treeMap.size());
   
           try {
               treeMap.firstKey();
               fail("should throw NoSuchElementException");
           } catch (NoSuchElementException e) {
               // Expected
           }
           assertNull(treeMap.firstEntry());
   
          try {
              treeMap.lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
          assertNull(treeMap.lastEntry());
  
          try {
              treeMap.ceilingKey(1);
          } catch (NoSuchElementException e) {
              // Expected
          }
          assertNull(treeMap.ceilingEntry(1));
  
          try {
              treeMap.floorKey(1);
          } catch (NoSuchElementException e) {
              // Expected
          }
          assertNull(treeMap.floorEntry(1));
          assertNull(treeMap.lowerKey(1));
          assertNull(treeMap.lowerEntry(1));
          assertNull(treeMap.higherKey(1));
          assertNull(treeMap.higherEntry(1));
          assertFalse(treeMap.containsKey(1));
          assertFalse(treeMap.containsValue(1));
          assertNull(treeMap.get(1));
  
          assertNull(treeMap.pollFirstEntry());
          assertNull(treeMap.pollLastEntry());
          assertEquals(0, treeMap.values().size());
      }
  
      public void test_TreeMap_Constructor_Comparator() {
          MockComparator mockComparator = new MockComparator();
          TreeMap treeMap = new TreeMap(mockComparator);
  
          assertEquals(mockComparatortreeMap.comparator());
      }
  
      public void test_TreeMap_Constructor_Map() {
          TreeMap treeMap = new TreeMap();
          assertEquals(.size(), treeMap.size());
          assertEquals(.firstKey(), treeMap.firstKey());
          assertEquals(.firstEntry(), treeMap.firstEntry());
          assertEquals(.lastKey(), treeMap.lastKey());
          assertEquals(.lastEntry(), treeMap.lastEntry());
          assertEquals(.keySet(), treeMap.keySet());
  
          String key = new Integer(100).toString();
          assertEquals(.ceilingKey(key), treeMap.ceilingKey(key));
          assertEquals(.ceilingEntry(key), treeMap.ceilingEntry(key));
          assertEquals(.floorKey(key), treeMap.floorKey(key));
          assertEquals(.floorEntry(key), treeMap.floorEntry(key));
          assertEquals(.lowerKey(key), treeMap.lowerKey(key));
          assertEquals(.lowerEntry(key), treeMap.lowerEntry(key));
          assertEquals(.higherKey(key), treeMap.higherKey(key));
          assertEquals(.higherEntry(key), treeMap.higherEntry(key));
          assertEquals(.entrySet(), treeMap.entrySet());
      }
  
      public void test_TreeMap_Constructor_SortedMap() {
          TreeMap treeMap = new TreeMap();
          assertEquals(.size(), treeMap.size());
          assertEquals(.firstKey(), treeMap.firstKey());
          assertEquals(.lastKey(), treeMap.lastKey());
          assertEquals(.keySet(), treeMap.keySet());
          assertEquals(.entrySet(), treeMap.entrySet());
      }
  
      public void test_TreeMap_clear() {
          .clear();
          assertEquals(0, .size());
      }
  
      public void test_TreeMap_clone() {
          TreeMap cloneTreeMap = (TreeMap.clone();
          assertEquals(cloneTreeMap);
      }
  
      public void test_SubMap_Constructor() {
      }
  
      public void test_SubMap_clear() {
          .clear();
          assertEquals(0, .size());
      }
  
      public void test_SubMap_comparator() {
      }
  
      public void test_SubMap_containsKey() {
          String key = null;
          for (int counter = 101; counter < 109; counter++) {
              key = [counter].toString();
              assertTrue("SubMap contains incorrect elements"
                      .containsKey(key));
              assertTrue("SubMap contains incorrect elements",
                      .containsKey(key));
              assertTrue("SubMap contains incorrect elements",
                      .containsKey(key));
              assertTrue("SubMap contains incorrect elements",
                      .containsKey(key));
              assertTrue("SubMap contains incorrect elements",
                      .containsKey(key));
          }
  
          // Check boundary
          key = [100].toString();
          assertTrue("SubMap contains incorrect elements"
                  .containsKey(key));
          assertFalse("SubMap contains incorrect elements",
                  .containsKey(key));
          assertFalse("SubMap contains incorrect elements",
                  .containsKey(key));
          assertTrue("SubMap contains incorrect elements",
                  .containsKey(key));
          assertTrue("SubMap contains incorrect elements",
                  .containsKey(key));
  
          key = [109].toString();
          assertFalse("SubMap contains incorrect elements"
                  .containsKey(key));
          assertFalse("SubMap contains incorrect elements",
                  .containsKey(key));
          assertTrue("SubMap contains incorrect elements",
                  .containsKey(key));
          assertFalse("SubMap contains incorrect elements",
                  .containsKey(key));
          assertTrue("SubMap contains incorrect elements",
                  .containsKey(key));
  
          // With Comparator
          for (int counter = 101; counter < 109; counter++) {
              key = [counter].toString();
              assertTrue("SubMap contains incorrect elements",
                      .containsKey(key));
              assertTrue("SubMap contains incorrect elements",
                      
                              .containsKey(key));
              assertTrue("SubMap contains incorrect elements",
                      
                              .containsKey(key));
              assertTrue("SubMap contains incorrect elements",
                      
                              .containsKey(key));
              assertTrue("SubMap contains incorrect elements",
                      
                              .containsKey(key));
          }
  
          // Check boundary
          key = [100].toString();
          assertTrue("SubMap contains incorrect elements",
                  .containsKey(key));
          assertFalse("SubMap contains incorrect elements",
                  .containsKey(key));
          assertFalse("SubMap contains incorrect elements",
                  .containsKey(key));
          assertTrue("SubMap contains incorrect elements",
                  .containsKey(key));
          assertTrue("SubMap contains incorrect elements",
                  .containsKey(key));
  
          key = [109].toString();
          assertFalse("SubMap contains incorrect elements",
                  .containsKey(key));
          assertFalse("SubMap contains incorrect elements",
                  .containsKey(key));
          assertTrue("SubMap contains incorrect elements",
                  .containsKey(key));
          assertFalse("SubMap contains incorrect elements",
                  .containsKey(key));
          assertTrue("SubMap contains incorrect elements",
                  .containsKey(key));
      }
  
      public void test_SubMap_containsValue() {
          Object value = null;
          for (int counter = 101; counter < 109; counter++) {
              value = [counter];
              assertTrue("SubMap contains incorrect elements"
                      .containsValue(value));
              assertTrue("SubMap contains incorrect elements",
                      .containsValue(value));
              assertTrue("SubMap contains incorrect elements",
                      .containsValue(value));
              assertTrue("SubMap contains incorrect elements",
                      .containsValue(value));
              assertTrue("SubMap contains incorrect elements",
                      .containsValue(value));
          }
  
          // Check boundary
          value = [100];
          assertTrue("SubMap contains incorrect elements"
                  .containsValue(value));
          assertFalse("SubMap contains incorrect elements",
                  .containsValue(value));
          assertFalse("SubMap contains incorrect elements",
                  .containsValue(value));
          assertTrue("SubMap contains incorrect elements",
                  .containsValue(value));
          assertTrue("SubMap contains incorrect elements",
                  .containsValue(value));
  
          value = [109];
          assertFalse("SubMap contains incorrect elements"
                  .containsValue(value));
          assertFalse("SubMap contains incorrect elements",
                  .containsValue(value));
          assertTrue("SubMap contains incorrect elements",
                  .containsValue(value));
          assertFalse("SubMap contains incorrect elements",
                  .containsValue(value));
          assertTrue("SubMap contains incorrect elements",
                  .containsValue(value));
  
          assertFalse(.containsValue(null));
  
          TreeMap tm_null = new TreeMap();
          tm_null.put("0", 1);
          tm_null.put("1"null);
          tm_null.put("2", 2);
          SortedMap subMap = tm_null.subMap("0""2");
          assertTrue(subMap.containsValue(null));
  
          subMap.remove("1");
          assertFalse(subMap.containsValue(null));
      }
  
      public void test_SubMap_entrySet() {
          Set entrySet = .entrySet();
          assertFalse(entrySet.isEmpty());
          assertEquals(9, entrySet.size());
  
          entrySet = .entrySet();
          assertFalse(entrySet.isEmpty());
          assertEquals(8, entrySet.size());
  
          entrySet = .entrySet();
          assertFalse(entrySet.isEmpty());
          assertEquals(9, entrySet.size());
  
          entrySet = .entrySet();
          assertFalse(entrySet.isEmpty());
          assertEquals(9, entrySet.size());
  
          entrySet = .entrySet();
          assertFalse(entrySet.isEmpty());
          assertEquals(10, entrySet.size());
      }
  
      public void test_SubMap_firstKey() {
          String firstKey1 = new Integer(100).toString();
          String firstKey2 = new Integer(101).toString();
          assertEquals(firstKey1.firstKey());
          assertEquals(firstKey2.firstKey());
          assertEquals(firstKey2.firstKey());
          assertEquals(firstKey1.firstKey());
          assertEquals(firstKey1.firstKey());
  
          try {
              .subMap(firstKey1firstKey1).firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(firstKey2firstKey2)
                      .firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(firstKey2firstKey2)
                      .firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(firstKey1firstKey1)
                      .firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(firstKey1firstKey1)
                      .firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          // With Comparator
          assertEquals(firstKey1.firstKey());
                  .firstKey());
                  .firstKey());
                  .firstKey());
                  .firstKey());
  
          try {
              .subMap(firstKey1firstKey1).firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(firstKey2,
                      firstKey2).firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(firstKey2,
                      firstKey2).firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(firstKey1,
                      firstKey1).firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(firstKey1,
                      firstKey1).firstKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
      }
  
      public void test_SubMap_lastKey() {
          String lastKey1 = new Integer(108).toString();
          String lastKey2 = new Integer(109).toString();
          assertEquals(lastKey1.lastKey());
          assertEquals(lastKey1.lastKey());
          assertEquals(lastKey2.lastKey());
          assertEquals(lastKey1.lastKey());
          assertEquals(lastKey2.lastKey());
  
          try {
              .subMap(lastKey1lastKey1).lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(lastKey1lastKey1)
                      .lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(lastKey2lastKey2)
                      .lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(lastKey1lastKey1)
                      .lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(lastKey2lastKey2)
                      .lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          // With Comparator
          assertEquals(lastKey1.lastKey());
                  .lastKey());
                  .lastKey());
                  .lastKey());
                  .lastKey());
  
          try {
              .subMap(lastKey1lastKey1).lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(lastKey1,
                      lastKey1).lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(lastKey2,
                      lastKey2).lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(lastKey1,
                      lastKey1).lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
  
          try {
              .subMap(lastKey2,
                      lastKey2).lastKey();
              fail("should throw NoSuchElementException");
          } catch (NoSuchElementException e) {
              // Expected
          }
      }
  
      public void test_SubMap_get() {
          // left boundary
          Integer value = new Integer(100);
          assertEquals(value.get(value.toString()));
          assertEquals(null.get(value
                  .toString()));
          assertEquals(null.get(value
                  .toString()));
          assertEquals(value.get(value
                  .toString()));
          assertEquals(value.get(value
                  .toString()));
  
          // normal value
          value = new Integer(105);
          assertEquals(value.get(value.toString()));
          assertEquals(value.get(value
                  .toString()));
          assertEquals(value.get(value
                  .toString()));
          assertEquals(value.get(value
                  .toString()));
          assertEquals(value.get(value
                  .toString()));
  
          // right boundary
          value = new Integer(109);
          assertEquals(null.get(value.toString()));
          assertEquals(null.get(value
                  .toString()));
          assertEquals(value.get(value
                  .toString()));
          assertEquals(null.get(value
                  .toString()));
          assertEquals(value.get(value
                  .toString()));
  
          // With Comparator to test inInRange
          // left boundary
          value = new Integer(100);
          assertEquals(value.get(value.toString()));
  
          // normal value
          value = new Integer(105);
          assertEquals(value.get(value.toString()));
  
          // right boundary
          value = new Integer(109);
          assertEquals(null.get(value.toString()));
      }
  
      public void test_SubMap_headMap() {
          String endKey = new Integer(99).toString();
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          SortedMap headMap = null;
          endKey = new Integer(100).toString();
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          for (int i = 0, j = 101; i < 8; i++) {
              endKey = new Integer(i + j).toString();
              headMap = .headMap(endKey);
              assertEquals(i + 1, headMap.size());
  
              headMap = .headMap(endKey);
              assertEquals(iheadMap.size());
  
              headMap = .headMap(endKey);
              assertEquals(iheadMap.size());
  
              headMap = .headMap(endKey);
              assertEquals(i + 1, headMap.size());
  
              headMap = .headMap(endKey);
              assertEquals(i + 1, headMap.size());
          }
  
          endKey = new Integer(109).toString();
          headMap = .headMap(endKey);
          assertEquals(9, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(8, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(8, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(9, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(9, headMap.size());
  
          endKey = new Integer(110).toString();
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          // With Comparator
          endKey = new Integer(99).toString();
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          headMap = null;
          endKey = new Integer(100).toString();
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(0, headMap.size());
  
          for (int i = 0, j = 101; i < 8; i++) {
              endKey = new Integer(i + j).toString();
              headMap = .headMap(endKey);
              assertEquals(i + 1, headMap.size());
  
              headMap = 
                      .headMap(endKey);
              assertEquals(iheadMap.size());
  
              headMap = 
                      .headMap(endKey);
              assertEquals(iheadMap.size());
  
              headMap = 
                      .headMap(endKey);
              assertEquals(i + 1, headMap.size());
  
              headMap = 
                      .headMap(endKey);
              assertEquals(i + 1, headMap.size());
          }
  
          endKey = new Integer(108).toString();
          headMap = .headMap(endKey);
          assertEquals(8, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(7, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(7, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(8, headMap.size());
  
          headMap = .headMap(endKey);
          assertEquals(8, headMap.size());
  
          endKey = new Integer(110).toString();
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .headMap(endKey);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
      }
  
      public void test_SubMap_isEmpty() {
          assertFalse(.isEmpty());
  
          Object startKey = new Integer(100);
          Object endKey = startKey;
          SortedMap subMap = .subMap(startKey.toString(), endKey.toString());
          assertTrue(subMap.isEmpty());
          subMap = .subMap(startKey.toString(), endKey.toString());
          assertTrue(subMap.isEmpty());
          subMap = .subMap(startKey.toString(),
                  endKey.toString());
          assertTrue(subMap.isEmpty());
          subMap = .subMap(startKey.toString(),
                  endKey.toString());
          assertTrue(subMap.isEmpty());
  
          for (int i = 0, j = 101; i < 8; i++) {
              startKey = i + j;
              endKey = startKey;
  
              subMap = .subMap(startKey.toString(), endKey
                      .toString());
              assertTrue(subMap.isEmpty());
  
              subMap = .subMap(startKey
                      .toString(), endKey.toString());
              assertTrue(subMap.isEmpty());
  
              subMap = .subMap(startKey
                      .toString(), endKey.toString());
              assertTrue(subMap.isEmpty());
  
              subMap = .subMap(startKey
                      .toString(), endKey.toString());
              assertTrue(subMap.isEmpty());
  
              subMap = .subMap(startKey
                      .toString(), endKey.toString());
              assertTrue(subMap.isEmpty());
          }
  
          for (int i = 0, j = 101; i < 5; i++) {
              startKey = i + j;
              endKey = i + j + 4;
  
              subMap = .subMap(startKey.toString(), endKey
                      .toString());
              assertFalse(subMap.isEmpty());
  
              subMap = .subMap(startKey
                      .toString(), endKey.toString());
              assertFalse(subMap.isEmpty());
  
              subMap = .subMap(startKey
                      .toString(), endKey.toString());
              assertFalse(subMap.isEmpty());
  
              subMap = .subMap(startKey
                      .toString(), endKey.toString());
              assertFalse(subMap.isEmpty());
  
              subMap = .subMap(startKey
                      .toString(), endKey.toString());
              assertFalse(subMap.isEmpty());
          }
  
          startKey = new Integer(109).toString();
          endKey = startKey;
          subMap = .subMap(startKey.toString(), endKey.toString());
          assertTrue(subMap.isEmpty());
          subMap = .subMap(startKeyendKey);
          assertTrue(subMap.isEmpty());
          subMap = .subMap(startKeyendKey);
          assertTrue(subMap.isEmpty());
  
      }
  
      public void test_SubMap_keySet() {
          Set keySet = .keySet();
          assertFalse(keySet.isEmpty());
          assertEquals(9, keySet.size());
  
          keySet = .entrySet();
          assertFalse(keySet.isEmpty());
          assertEquals(8, keySet.size());
  
          keySet = .entrySet();
          assertFalse(keySet.isEmpty());
          assertEquals(9, keySet.size());
  
          keySet = .entrySet();
          assertFalse(keySet.isEmpty());
          assertEquals(9, keySet.size());
  
          keySet = .entrySet();
          assertFalse(keySet.isEmpty());
          assertEquals(10, keySet.size());
      }
  
      public void test_SubMap_put() {
          Integer value = new Integer(100);
          int addValue = 5;
  
          .put(value.toString(), value + addValue);
          assertEquals(value + addValue.get(value.toString()));
  
          try {
              .put(value.toString(), value
                      + addValue);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
          try {
              .put(value.toString(), value
                      + addValue);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
          }
  
                  .put(value.toString(), value + addValue);
          assertEquals(value + addValue
                  .get(value.toString()));
  
                  .put(value.toString(), value + addValue);
          assertEquals(value + addValue
                  .get(value.toString()));
  
          value = new Integer(109);
          try {
              .put(value.toString(), value + addValue);
              fail("should throw IllegalArgumentException");
          } catch (IllegalArgumentException e) {
              // Expected
         }
         try {
             .put(value.toString(), value
                     + addValue);
             fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
             // Expected
         }
                 .put(value.toString(), value + addValue);
         assertEquals(value + addValue
                 .get(value.toString()));
         try {
             .put(value.toString(), value
                     + addValue);
             fail("should throw IllegalArgumentException");
         } catch (IllegalArgumentException e) {
             // Expected
         }
                 .put(value.toString(), value + addValue);
         assertEquals(value + addValue