[507] | 1 | package gov.hhs.fha.nhinc.properties;
|
---|
| 2 |
|
---|
| 3 | import java.util.Properties;
|
---|
| 4 | import org.junit.After;
|
---|
| 5 | import org.junit.AfterClass;
|
---|
| 6 | import org.junit.Before;
|
---|
| 7 | import org.junit.BeforeClass;
|
---|
| 8 | import org.junit.Test;
|
---|
| 9 | import static org.junit.Assert.*;
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | * This unit test is used to test the FileManagerTest class.
|
---|
| 13 | *
|
---|
| 14 | * @author Les Westberg
|
---|
| 15 | */
|
---|
| 16 | public class PropertyFileManagerTest
|
---|
| 17 | {
|
---|
| 18 |
|
---|
| 19 | public PropertyFileManagerTest()
|
---|
| 20 | {
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | @BeforeClass
|
---|
| 24 | public static void setUpClass() throws Exception
|
---|
| 25 | {
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | @AfterClass
|
---|
| 29 | public static void tearDownClass() throws Exception
|
---|
| 30 | {
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | @Before
|
---|
| 34 | public void setUp()
|
---|
| 35 | {
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | @After
|
---|
| 39 | public void tearDown()
|
---|
| 40 | {
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | /**
|
---|
| 44 | * Test of writePropertyFile method, of class PropertyFileManager.
|
---|
| 45 | */
|
---|
| 46 | @Test
|
---|
| 47 | public void testWritePropertyFile() throws Exception
|
---|
| 48 | {
|
---|
| 49 | System.out.println("writePropertyFile");
|
---|
| 50 | String sPropertyFile = "testprops";
|
---|
| 51 | Properties oProps = new Properties();
|
---|
| 52 | oProps.setProperty("CacheRefreshDuration", "0");
|
---|
| 53 | oProps.setProperty("Prop1", "Value1");
|
---|
| 54 | oProps.setProperty("Prop2", "Value2");
|
---|
| 55 | PropertyFileManager.writePropertyFile(sPropertyFile, oProps);
|
---|
| 56 |
|
---|
| 57 | String sValue = PropertyAccessor.getProperty(sPropertyFile, "CacheRefreshDuration");
|
---|
| 58 | assertEquals("0", sValue);
|
---|
| 59 |
|
---|
| 60 | sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop1");
|
---|
| 61 | assertEquals("Value1", sValue);
|
---|
| 62 |
|
---|
| 63 | sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop2");
|
---|
| 64 | assertEquals("Value2", sValue);
|
---|
| 65 |
|
---|
| 66 | oProps.setProperty("Prop3", "Value3");
|
---|
| 67 | PropertyFileManager.writePropertyFile(sPropertyFile, oProps);
|
---|
| 68 |
|
---|
| 69 | sValue = PropertyAccessor.getProperty(sPropertyFile, "CacheRefreshDuration");
|
---|
| 70 | assertEquals("0", sValue);
|
---|
| 71 |
|
---|
| 72 | sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop1");
|
---|
| 73 | assertEquals("Value1", sValue);
|
---|
| 74 |
|
---|
| 75 | sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop2");
|
---|
| 76 | assertEquals("Value2", sValue);
|
---|
| 77 |
|
---|
| 78 | sValue = PropertyAccessor.getProperty(sPropertyFile, "Prop3");
|
---|
| 79 | assertEquals("Value3", sValue);
|
---|
| 80 |
|
---|
| 81 | PropertyFileManager.deletePropertyFile(sPropertyFile);
|
---|
| 82 |
|
---|
| 83 | }
|
---|
| 84 | }
|
---|