org.apache.commons.configuration
Class TestPropertiesConfigurationLayout

java.lang.Object
  extended by org.apache.commons.configuration.TestPropertiesConfigurationLayout

public class TestPropertiesConfigurationLayout
extends Object

Test class for PropertiesConfigurationLayout.

Version:
$Id: TestPropertiesConfigurationLayout.java 1301996 2012-03-17 20:30:39Z sebb $
Author:
Commons Configuration team

Constructor Summary
TestPropertiesConfigurationLayout()
           
 
Method Summary
 void setUp()
           
 void testBlancLines()
          Tests whether blanc lines before a property are correctly detected.
 void testCombineComments()
          Tests whether comments are combined for multiple occurrences.
 void testEventAdd()
          Tests if a property add event is correctly processed.
 void testEventAddBefore()
          Tests if a before update event is correctly ignored.
 void testEventAddExisting()
          Tests if an add event is correctly processed if the affected property is already stored in the layout object.
 void testEventAddMultiple()
          Tests adding a property multiple time through an event.
 void testEventClearConfig()
          Tests if a clear event is correctly processed.
 void testEventDelete()
          Tests if a property delete event is correctly processed.
 void testEventReload()
          Tests if a reload update is correctly processed.
 void testEventReloadAfter()
          Tests the event after a reload has been performed.
 void testEventSetNonExisting()
          Tests if a set property event for a non existing property is correctly handled.
 void testGetNonExistingLayouData()
          Tests accessing data for a property, which is not stored.
 void testGetNullLayouttData()
          Tests accessing a property with a null key.
 void testHeaderComment()
          Tests if a header comment is detected.
 void testHeaderCommentNull()
          Tests fetching a canonical header comment when no comment is set.
 void testHeaderCommentWithBlancs()
          Tests if a header comment containing blanc lines is correctly detected.
 void testHeaderCommentWithBlancsAndPropComment()
          Tests if a header comment is correctly detected when it contains blanc lines and the first property has a comment, too.
 void testInit()
          Tests a newly created instance.
 void testInitCopy()
          Tests the copy constructor.
 void testInitCopyModify()
          Tests if the copy and the original are independent from each other.
 void testInitNull()
          Tests creating a layout object with a null configuration.
 void testIsSingleLine()
          Tests the single line flag for a simple property definition.
 void testIsSingleLineMulti()
          Tests the single line flag if there are multiple property definitions.
 void testReadAndWrite()
          Tests whether the output of the layout object is identical to the source file (at least for simple properties files).
 void testReadSimple()
          Tests reading a simple properties file.
 void testRecursiveLoadCall()
          Tests a recursive load call.
 void testSave()
          Tests if the content of the layout object is correctly written.
 void testSaveCommentForUnexistingProperty()
          Tests saving when a comment for a non existing property is contained in the layout object.
 void testSaveEmptyLayout()
          Tests saving an empty layout object.
 void testSaveForceSingleLine()
          Tests the force single line flag.
 void testSetGlobalSeparator()
          Tests setting the global separator.
 void testSetLineSeparator()
          Tests setting the line separator.
 void testSetLineSeparatorInComments()
          Tests whether the line separator is also taken into account within comments.
 void testSetNullComment()
          Tests resetting a comment.
 void testSetSeparator()
          Tests changing the separator for a property.
 void testTrimComment()
          Tests the trimComment method.
 void testTrimCommentFalse()
          Tests enforcing comment characters in a comment.
 void testTrimCommentTrainlingCR()
          Tests trimming a comment with trailing CRs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestPropertiesConfigurationLayout

public TestPropertiesConfigurationLayout()
Method Detail

setUp

public void setUp()
           throws Exception
Throws:
Exception

testInit

public void testInit()
Tests a newly created instance.


testInitNull

public void testInitNull()
Tests creating a layout object with a null configuration. This should cause an exception.


testReadSimple

public void testReadSimple()
                    throws ConfigurationException
Tests reading a simple properties file.

Throws:
ConfigurationException

testBlancLines

public void testBlancLines()
                    throws ConfigurationException
Tests whether blanc lines before a property are correctly detected.

Throws:
ConfigurationException

testIsSingleLine

public void testIsSingleLine()
                      throws ConfigurationException
Tests the single line flag for a simple property definition.

Throws:
ConfigurationException

testIsSingleLineMulti

public void testIsSingleLineMulti()
                           throws ConfigurationException
Tests the single line flag if there are multiple property definitions.

Throws:
ConfigurationException

testCombineComments

public void testCombineComments()
                         throws ConfigurationException
Tests whether comments are combined for multiple occurrences.

Throws:
ConfigurationException

testHeaderComment

public void testHeaderComment()
                       throws ConfigurationException
Tests if a header comment is detected.

Throws:
ConfigurationException

testHeaderCommentWithBlancs

public void testHeaderCommentWithBlancs()
                                 throws ConfigurationException
Tests if a header comment containing blanc lines is correctly detected.

Throws:
ConfigurationException

testHeaderCommentWithBlancsAndPropComment

public void testHeaderCommentWithBlancsAndPropComment()
                                               throws ConfigurationException
Tests if a header comment is correctly detected when it contains blanc lines and the first property has a comment, too.

Throws:
ConfigurationException

testHeaderCommentNull

public void testHeaderCommentNull()
Tests fetching a canonical header comment when no comment is set.


testEventAdd

public void testEventAdd()
Tests if a property add event is correctly processed.


testEventAddMultiple

public void testEventAddMultiple()
Tests adding a property multiple time through an event. The property should then be a multi-line property.


testEventAddExisting

public void testEventAddExisting()
                          throws ConfigurationException
Tests if an add event is correctly processed if the affected property is already stored in the layout object.

Throws:
ConfigurationException

testEventSetNonExisting

public void testEventSetNonExisting()
Tests if a set property event for a non existing property is correctly handled.


testEventDelete

public void testEventDelete()
Tests if a property delete event is correctly processed.


testEventClearConfig

public void testEventClearConfig()
                          throws Exception
Tests if a clear event is correctly processed.

Throws:
Exception

testEventAddBefore

public void testEventAddBefore()
Tests if a before update event is correctly ignored.


testEventReload

public void testEventReload()
Tests if a reload update is correctly processed.


testEventReloadAfter

public void testEventReloadAfter()
Tests the event after a reload has been performed. This should be ignored.


testRecursiveLoadCall

public void testRecursiveLoadCall()
                           throws ConfigurationException
Tests a recursive load call.

Throws:
ConfigurationException

testReadAndWrite

public void testReadAndWrite()
                      throws ConfigurationException
Tests whether the output of the layout object is identical to the source file (at least for simple properties files).

Throws:
ConfigurationException

testSave

public void testSave()
              throws ConfigurationException
Tests if the content of the layout object is correctly written.

Throws:
ConfigurationException

testSaveForceSingleLine

public void testSaveForceSingleLine()
                             throws ConfigurationException
Tests the force single line flag.

Throws:
ConfigurationException

testTrimComment

public void testTrimComment()
Tests the trimComment method.


testTrimCommentTrainlingCR

public void testTrimCommentTrainlingCR()
Tests trimming a comment with trailing CRs.


testTrimCommentFalse

public void testTrimCommentFalse()
Tests enforcing comment characters in a comment.


testGetNonExistingLayouData

public void testGetNonExistingLayouData()
Tests accessing data for a property, which is not stored.


testGetNullLayouttData

public void testGetNullLayouttData()
Tests accessing a property with a null key. This should throw an exception.


testSetNullComment

public void testSetNullComment()
Tests resetting a comment.


testSaveCommentForUnexistingProperty

public void testSaveCommentForUnexistingProperty()
                                          throws ConfigurationException
Tests saving when a comment for a non existing property is contained in the layout object. This comment should be ignored.

Throws:
ConfigurationException

testSaveEmptyLayout

public void testSaveEmptyLayout()
                         throws ConfigurationException
Tests saving an empty layout object.

Throws:
ConfigurationException

testInitCopy

public void testInitCopy()
Tests the copy constructor.


testInitCopyModify

public void testInitCopyModify()
Tests if the copy and the original are independent from each other.


testSetSeparator

public void testSetSeparator()
                      throws ConfigurationException
Tests changing the separator for a property.

Throws:
ConfigurationException

testSetGlobalSeparator

public void testSetGlobalSeparator()
                            throws ConfigurationException
Tests setting the global separator. This separator should override the separators for all properties.

Throws:
ConfigurationException

testSetLineSeparator

public void testSetLineSeparator()
                          throws ConfigurationException
Tests setting the line separator.

Throws:
ConfigurationException

testSetLineSeparatorInComments

public void testSetLineSeparatorInComments()
                                    throws ConfigurationException
Tests whether the line separator is also taken into account within comments.

Throws:
ConfigurationException


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.