tests/libjava-mauve/src/gnu/testlet/java/util/Hashtable/HashContains.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 // Tags: JDK1.2
       
     2 
       
     3 // Copyright (C) 2003 Mark J. Wielaard
       
     4 
       
     5 // This file is part of Mauve.
       
     6 
       
     7 // Mauve is free software; you can redistribute it and/or modify
       
     8 // it under the terms of the GNU General Public License as published by
       
     9 // the Free Software Foundation; either version 2, or (at your option)
       
    10 // any later version.
       
    11 
       
    12 // Mauve is distributed in the hope that it will be useful,
       
    13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    15 // GNU General Public License for more details.
       
    16 
       
    17 // You should have received a copy of the GNU General Public License
       
    18 // along with Mauve; see the file COPYING.  If not, write to
       
    19 // the Free Software Foundation, 59 Temple Place - Suite 330,
       
    20 // Boston, MA 02111-1307, USA.  */
       
    21 
       
    22 package gnu.testlet.java.util.Hashtable;
       
    23 
       
    24 import gnu.testlet.Testlet;
       
    25 import gnu.testlet.TestHarness;
       
    26 import java.util.Hashtable;
       
    27 
       
    28 /**
       
    29  * Test whether overriding contains and the new 1.2 (Map interface)
       
    30  * containsValue work properly.
       
    31  */
       
    32 public class HashContains extends Hashtable implements Testlet
       
    33 {
       
    34   public void test (TestHarness harness)
       
    35   {
       
    36     Object a = new Object();
       
    37     Object b = new Object();
       
    38     Object c;
       
    39 
       
    40     c = put(a, b);
       
    41     harness.check(null, c);
       
    42     harness.check(!contains(a));
       
    43     harness.check(contains(b));
       
    44 
       
    45     harness.check(!containsValue(a));
       
    46     harness.check(containsValue(b));
       
    47   }
       
    48 
       
    49   // Override and call super.
       
    50   public boolean contains(Object value) {
       
    51     return super.contains(value);
       
    52   }
       
    53 
       
    54   // Override and call contains.
       
    55   public boolean containsValue(Object value) {
       
    56     return this.contains(value);
       
    57   }
       
    58 }
       
    59