1   /*
2    * The SmartWeb Framework
3    * Copyright (C) 2004-2006
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18   *
19   * For further informations on the SmartWeb Framework please visit
20   *
21   *                        http://smartweb.sourceforge.net
22   */
23  package net.smartlab.web;
24  
25  import junit.framework.TestCase;
26  
27  /**
28   * @TODO documentation
29   * @author rlogiacco
30   */
31  public class PropertiesEnumerationTest extends TestCase {
32  
33  	private Mock mock = new Mock();
34  
35  
36  	/**
37  	 * Test method for {@link net.smartlab.web.StringEnumeration#getCode()}.
38  	 */
39  	public void testGetCode() {
40  		super.assertEquals("first", mock.decode("first").getCode());
41  		super.assertEquals("second", mock.decode("second").getCode());
42  		super.assertEquals("third", mock.decode("third").getCode());
43  	}
44  
45  	/**
46  	 * Test method for {@link net.smartlab.web.StringEnumeration#getDisplay()}.
47  	 */
48  	public void testGetDisplay() {
49  		super.assertEquals("First", mock.decode("first").getDisplay());
50  		super.assertEquals("Second", mock.decode("second").getDisplay());
51  		super.assertEquals("Third", mock.decode("third").getDisplay());
52  	}
53  
54  	/**
55  	 * Test method for
56  	 * {@link net.smartlab.web.PropertiesEnumeration#decode(java.lang.String)}.
57  	 */
58  	public void testDecode() {
59  		super.assertNotNull(mock.decode("first"));
60  		super.assertNotNull(mock.decode("second"));
61  		super.assertNotNull(mock.decode("third"));
62  		super.assertNull(mock.decode("fourth"));
63  	}
64  
65  
66  	private static class Mock extends PropertiesEnumeration {
67  
68  		private static final long serialVersionUID = 1L;
69  
70  		public Mock() {
71  			super();
72  		}
73  		
74  		public Mock(String code, String display) {
75  			super(code, display);
76  		}
77  	}
78  }