Java Code Examples for org.apache.commons.configuration2.io.FileHandler#removeFileHandlerListener()

The following examples show how to use org.apache.commons.configuration2.io.FileHandler#removeFileHandlerListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestAutoSaveListener.java    From commons-configuration with Apache License 2.0 5 votes vote down vote up
/**
 * Tests whether the file handler can be updated and is correctly
 * initialized.
 */
@Test
public void testUpdateFileHandler()
{
    final FileHandler handler = EasyMock.createMock(FileHandler.class);
    final FileHandler handler2 = EasyMock.createMock(FileHandler.class);
    handler.addFileHandlerListener(listener);
    handler.removeFileHandlerListener(listener);
    handler2.addFileHandlerListener(listener);
    EasyMock.replay(handler, handler2);
    listener.updateFileHandler(handler);
    listener.updateFileHandler(handler2);
    EasyMock.verify(handler, handler2);
}
 
Example 2
Source File: TestAutoSaveListener.java    From commons-configuration with Apache License 2.0 5 votes vote down vote up
/**
 * Tests whether updateFileHandler() can deal with null input. This is used
 * for removing the listener when it is no longer needed.
 */
@Test
public void testUpdateFileHandlerNull()
{
    final FileHandler handler = EasyMock.createMock(FileHandler.class);
    handler.addFileHandlerListener(listener);
    handler.removeFileHandlerListener(listener);
    EasyMock.replay(handler);
    listener.updateFileHandler(handler);
    listener.updateFileHandler(null);
    EasyMock.verify(handler);
}