tests/libjava-mauve/src/gnu/testlet/java/util/AbstractCollection/AcuniaAddCollectionTest.java
branchjk_new_structure
changeset 1541 75c2e24dea9a
parent 1540 92ac284961c1
child 1542 be11db817bcf
equal deleted inserted replaced
1540:92ac284961c1 1541:75c2e24dea9a
     1 /* Copyright (C) 2001 ACUNIA
       
     2 
       
     3    This file is part of Mauve.
       
     4 
       
     5    Mauve is free software; you can redistribute it and/or modify
       
     6    it under the terms of the GNU General Public License as published by
       
     7    the Free Software Foundation; either version 2, or (at your option)
       
     8    any later version.
       
     9 
       
    10    Mauve is distributed in the hope that it will be useful,
       
    11    but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    13    GNU General Public License for more details.
       
    14 
       
    15    You should have received a copy of the GNU General Public License
       
    16    along with Mauve; see the file COPYING.  If not, write to
       
    17    the Free Software Foundation, 59 Temple Place - Suite 330,
       
    18    Boston, MA 02111-1307, USA.
       
    19 */
       
    20 
       
    21 // Tags: JDK1.2
       
    22 
       
    23 package gnu.testlet.java.util.AbstractCollection;
       
    24 
       
    25 import gnu.testlet.Testlet;
       
    26 import gnu.testlet.TestHarness;
       
    27 
       
    28 import java.util.*;
       
    29 
       
    30 /**
       
    31 *  Written by ACUNIA. <br>
       
    32 *                        <br>
       
    33 *  this file contains tests for java.util.AbstractCollection   <br>
       
    34 *
       
    35 */
       
    36 public class AcuniaAddCollectionTest extends AbstractCollection
       
    37                                      implements Testlet
       
    38 {
       
    39   protected TestHarness th;
       
    40 
       
    41   public void test (TestHarness harness)
       
    42     {
       
    43        th = harness;
       
    44        test_add();
       
    45     }
       
    46 
       
    47 /**
       
    48 *  implemented. <br>
       
    49 *
       
    50 */
       
    51   public void test_add(){
       
    52     th.checkPoint("add(java.lang.Object)boolean");
       
    53     AcuniaAddCollectionTest eac = new AcuniaAddCollectionTest();
       
    54     try {
       
    55     	eac.add(this);
       
    56     	th.fail("should throw an UnsupportedOperationException");
       
    57     	}
       
    58     catch (UnsupportedOperationException uoe) { th.check(true);}
       
    59   }
       
    60 
       
    61 // The following fields and methods are needed to use this class as a
       
    62 // AbstractCollection implementation.
       
    63 
       
    64         public Vector v;
       
    65 
       
    66 
       
    67         public AcuniaAddCollectionTest(){
       
    68                 super();
       
    69                 v=new Vector();
       
    70         }
       
    71 
       
    72         public int size() {
       
    73                 return v.size();
       
    74         }
       
    75 
       
    76         public Iterator iterator() {
       
    77                 return v.iterator();
       
    78         }
       
    79 }