< prev index next >

test/java/util/Map/LockStep.java

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 6612102
  27  * @summary Test Map implementations for mutual compatibility

  28  */
  29 
  30 import java.util.*;
  31 import java.util.concurrent.*;
  32 
  33 /**
  34  * Based on the strange scenario required to reproduce
  35  * (coll) IdentityHashMap.iterator().remove() might decrement size twice
  36  *
  37  * It would be good to add more "Lockstep-style" tests to this file.
  38  */
  39 public class LockStep {
  40     void mapsEqual(Map m1, Map m2) {
  41         equal(m1, m2);
  42         equal(m2, m1);
  43         equal(m1.size(), m2.size());
  44         equal(m1.isEmpty(), m2.isEmpty());
  45         equal(m1.keySet(), m2.keySet());
  46         equal(m2.keySet(), m1.keySet());
  47     }




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 6612102
  27  * @summary Test Map implementations for mutual compatibility
  28  * @key randomness
  29  */
  30 
  31 import java.util.*;
  32 import java.util.concurrent.*;
  33 
  34 /**
  35  * Based on the strange scenario required to reproduce
  36  * (coll) IdentityHashMap.iterator().remove() might decrement size twice
  37  *
  38  * It would be good to add more "Lockstep-style" tests to this file.
  39  */
  40 public class LockStep {
  41     void mapsEqual(Map m1, Map m2) {
  42         equal(m1, m2);
  43         equal(m2, m1);
  44         equal(m1.size(), m2.size());
  45         equal(m1.isEmpty(), m2.isEmpty());
  46         equal(m1.keySet(), m2.keySet());
  47         equal(m2.keySet(), m1.keySet());
  48     }


< prev index next >