Source code: marauroa/Test_Configuration.java
1 /* $Id: Test_Configuration.java,v 1.5 2003/12/09 23:09:34 arianne_rpg Exp $ */
2 /***************************************************************************
3 * (C) Copyright 2003 - Marauroa *
4 ***************************************************************************
5 ***************************************************************************
6 * *
7 * This program 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 of the License, or *
10 * (at your option) any later version. *
11 * *
12 ***************************************************************************/
13 package marauroa;
14
15 import junit.framework.*;
16
17 public class Test_Configuration extends TestCase
18 {
19 public static Test suite ( )
20 {
21 return new TestSuite(Test_Configuration.class);
22 }
23
24 public void testConfiguration()
25 {
26 marauroad.trace("Test_Configuration::testConfiguration","?","This test case try to see if the Configuration class "+
27 "is able to load the file and get the test attribute and set it, and check that the value is the correct");
28 marauroad.trace("Test_Configuration::testConfiguration",">");
29
30 try
31 {
32 Configuration conf=Configuration.getConfiguration();
33
34 String result=conf.get("test_ATestString");
35 assertEquals(result,"ATestString");
36
37 conf.set("test_ATestString", "AnotherTestString");
38
39 result=conf.get("test_ATestString");
40 assertEquals(result,"AnotherTestString");
41
42 conf.set("test_ATestString", "ATestString");
43 }
44 catch(Configuration.PropertyFileNotFoundException e)
45 {
46 fail(e.getMessage());
47 }
48 catch(Configuration.PropertyNotFoundException e)
49 {
50 fail(e.getMessage());
51 }
52 finally
53 {
54 marauroad.trace("Test_Configuration::testConfiguration","<");
55 }
56 }
57 }