1   /*
2    * $Header: /cvsroot/jdbforms/dbforms/tests/test/org/dbforms/config/TestError.java,v 1.5 2004/08/18 13:12:00 hkollmann Exp $
3    * $Revision: 1.5 $
4    * $Date: 2004/08/18 13:12:00 $
5    *
6    * DbForms - a Rapid Application Development Framework
7    * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8    *
9    * This library is free software; you can redistribute it and/or
10   * modify it under the terms of the GNU Lesser General Public
11   * License as published by the Free Software Foundation; either
12   * version 2.1 of the License, or (at your option) any later version.
13   *
14   * This library is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this library; if not, write to the Free Software
21   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22   */
23  
24  package org.dbforms.config;
25  
26  import org.dbforms.util.AbstractTestCase;
27  
28  
29  
30  /***
31   *  Description of the Class
32   *
33   * @author     epugh
34   * @created    May 3, 2002
35   */
36  public class TestError extends AbstractTestCase {
37     private Error e = null;
38  
39     /***
40      * DOCUMENT ME!
41      *
42      * @throws Exception DOCUMENT ME!
43      */
44     public void setUp() throws Exception {
45        super.setUp();
46        e = new Error();
47     }
48  
49  
50     /***
51      * DOCUMENT ME!
52      *
53      * @throws Exception DOCUMENT ME!
54      */
55     public void testAddMessage() throws Exception {
56        e.setMessage("EN", "EN Error");
57        assertTrue("Make sure we don't have a message", e.getMessage("GB") == null);
58  
59        Message m = new Message();
60        m.setMessage("GB Error");
61        m.setLanguage("GB");
62        e.addMessage(m);
63        assertTrue("Make sure we get back appropriate message for lang",
64                   e.getMessage("GB").equals("GB Error"));
65     }
66  
67  
68     /***
69      * DOCUMENT ME!
70      *
71      * @throws Exception DOCUMENT ME!
72      */
73     public void testGetSetId() throws Exception {
74        e.setId("ERR_01");
75        assertTrue("ID should be ERR_01", e.getId().equals("ERR_01"));
76     }
77  
78  
79     /***
80      * DOCUMENT ME!
81      *
82      * @throws Exception DOCUMENT ME!
83      */
84     public void testSetMessage() throws Exception {
85        e.setMessage("EN", "EN Error");
86        e.setMessage("FR", "FR Error");
87        assertTrue("Make sure we get back appropriate message for lang",
88                   e.getMessage("FR").equals("FR Error"));
89        assertTrue("Make sure we get back appropriate message for lang",
90                   e.getMessage("EN").equals("EN Error"));
91     }
92  }