1   ////////////////////////////////////////////////////////////////////////////////
2   //CabaWeb
3   //Copyright (C) 2004  Thomas Vogt <Thomas.Vogt@TVC-Software.com>
4   //
5   //This library is free software; you can redistribute it and/or
6   //modify it under the terms of the GNU Lesser General Public
7   //License as published by the Free Software Foundation; either
8   //version 2.1 of the License, or (at your option) any later version.
9   //
10  //This library 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 GNU
13  //Lesser General Public License for more details.
14  //
15  //You should have received a copy of the GNU Lesser General Public
16  //License along with this library; if not, write to the Free Software
17  //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  ////////////////////////////////////////////////////////////////////////////////
19  
20  package org.fhw.cabaweb.junittests;
21  
22  import java.util.Collection;
23  
24  import org.fhw.cabaweb.data.DataInterfaceVoreinstellungenDouble;
25  import org.fhw.cabaweb.ojb.dataobjects.Projekte;
26  import org.fhw.cabaweb.ojb.dataobjects.Voreinstellungen_Double;
27  
28  import junit.framework.TestCase;
29  
30  /***
31   * Klasse f&uuml;r den Test der Datenzugriffe auf Voreinstellungen_Double
32   *
33   * @author  <a href="mailto:thomas.vogt@tvc-software.com">Thomas Vogt</a>
34   * @version Version 1.0 06.06.2004
35   */
36  public class DataInterfaceVoreinstellungenDoubleTest extends TestCase
37  {
38      private DataInterfaceVoreinstellungenDouble test;
39  
40      public static void main(String[] args)
41      {
42          junit.textui.TestRunner.run(DataInterfaceVoreinstellungenDoubleTest.class);
43      }
44  
45      /*
46       * @see TestCase#setUp()
47       */
48      protected void setUp() throws Exception
49      {
50          super.setUp();
51  
52          test = new DataInterfaceVoreinstellungenDouble();
53      }
54  
55      /*
56       * @see TestCase#tearDown()
57       */
58      protected void tearDown() throws Exception
59      {
60          super.tearDown();
61      }
62  
63      final public void testErzeugen()
64      {
65          Voreinstellungen_Double retval = null;
66  
67          Voreinstellungen_Double testvoreinstellungen = new Voreinstellungen_Double(new Projekte(new Integer(1), null, null, null));
68          testvoreinstellungen.setDouble1(new Double(1.11));
69          
70          test.erzeugen(testvoreinstellungen);
71  
72          retval = (Voreinstellungen_Double) test.sucheProjektnummer(new Integer(1));
73  
74          assertEquals(testvoreinstellungen.getDouble1(), retval.getDouble1());
75          test.loeschen(retval);
76      }
77  
78      final public void testEditieren()
79      {
80          Voreinstellungen_Double retval = null;
81  
82          Voreinstellungen_Double testvoreinstellungen = new Voreinstellungen_Double(new Projekte(new Integer(1), null, null, null));
83          testvoreinstellungen.setDouble1(new Double(1.11));
84          
85          test.erzeugen(testvoreinstellungen);
86  
87          testvoreinstellungen = new Voreinstellungen_Double(new Projekte(new Integer(1), null, null, null));
88          testvoreinstellungen.setDouble1(new Double(9.99));
89          
90          test.editieren(testvoreinstellungen);
91  
92          retval = (Voreinstellungen_Double) test.sucheProjektnummer(new Integer(1));
93  
94          assertEquals(testvoreinstellungen.getDouble1(), retval.getDouble1());
95          test.loeschen(retval);
96      }
97  
98      final public void testLoeschen()
99      {
100         Voreinstellungen_Double retval = null;
101 
102         Voreinstellungen_Double testvoreinstellungen = new Voreinstellungen_Double(new Projekte(new Integer(1), null, null, null));
103         testvoreinstellungen.setDouble1(new Double(1.11));
104         
105         test.erzeugen(testvoreinstellungen);
106         
107         testvoreinstellungen = new Voreinstellungen_Double(new Projekte(new Integer(1), null, null, null));
108         
109         test.loeschen(testvoreinstellungen);
110 
111         retval = (Voreinstellungen_Double) test.sucheProjektnummer(new Integer(1));
112 
113         assertNull(retval);
114     }
115 
116     final public void testSucheAlle()
117     {
118         Voreinstellungen_Double retval = null;
119 
120         Voreinstellungen_Double testvoreinstellungen = new Voreinstellungen_Double(new Projekte(new Integer(1), null, null, null));
121         testvoreinstellungen.setDouble1(new Double(1.11));
122         
123         test.erzeugen(testvoreinstellungen);
124 
125         Collection objekte = test.sucheAlle();
126 
127         assertNotSame(new Integer(0), new Integer(objekte.size()));
128 
129         java.util.Iterator iter = objekte.iterator();
130         while (iter.hasNext())
131         {
132 //          System.out.println(iter.next());
133             retval = (Voreinstellungen_Double) iter.next();
134         }         
135 
136         test.loeschen(retval);
137     }
138 
139     final public void testSucheProjektnummer()
140     {
141         Voreinstellungen_Double retval = null;
142 
143         Voreinstellungen_Double testvoreinstellungen = new Voreinstellungen_Double(new Projekte(new Integer(1), null, null, null));
144         testvoreinstellungen.setDouble1(new Double(1.11));
145         
146         test.erzeugen(testvoreinstellungen);
147 
148         retval = (Voreinstellungen_Double) test.sucheProjektnummer(new Integer(1));
149 
150         assertEquals(retval.getDouble1(), new Double(1.11));
151         test.loeschen(retval);
152     }
153 }