1 // SECTION-START[License Header] 2 // <editor-fold defaultstate="collapsed" desc=" Generated License "> 3 /* 4 * Java Object Management and Configuration 5 * Copyright (C) Christian Schulte, 2005-206 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 12 * o Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 15 * o Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in 17 * the documentation and/or other materials provided with the 18 * distribution. 19 * 20 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 22 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * $JOMC: DefaultListenerTest.java 4588 2012-06-03 06:01:30Z schulte2005 $ 32 * 33 */ 34 // </editor-fold> 35 // SECTION-END 36 package org.jomc.ri.test; 37 38 import org.jomc.ri.DefaultListener; 39 import org.junit.Test; 40 import static org.junit.Assert.assertFalse; 41 import static org.junit.Assert.assertTrue; 42 43 // SECTION-START[Documentation] 44 // <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> 45 /** 46 * {@code DefaultListener} test cases. 47 * 48 * <dl> 49 * <dt><b>Identifier:</b></dt><dd>JOMC :: RI :: Tests :: Default Listener Test</dd> 50 * <dt><b>Name:</b></dt><dd>JOMC :: RI :: Tests :: Default Listener Test</dd> 51 * <dt><b>Abstract:</b></dt><dd>No</dd> 52 * <dt><b>Final:</b></dt><dd>No</dd> 53 * <dt><b>Stateless:</b></dt><dd>No</dd> 54 * </dl> 55 * 56 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0 57 * @version 1.3 58 */ 59 // </editor-fold> 60 // SECTION-END 61 // SECTION-START[Annotations] 62 // <editor-fold defaultstate="collapsed" desc=" Generated Annotations "> 63 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" ) 64 // </editor-fold> 65 // SECTION-END 66 public class DefaultListenerTest extends ListenerTest 67 { 68 // SECTION-START[DefaultListenerTest] 69 70 /** {@inheritDoc} */ 71 @Override 72 public DefaultListener getListener() 73 { 74 return (DefaultListener) super.getListener(); 75 } 76 77 /** {@inheritDoc} */ 78 @Override 79 protected DefaultListener newListener() 80 { 81 return new DefaultListener(); 82 } 83 84 @Test 85 public final void testDefaultEnabled() throws Exception 86 { 87 assertTrue( DefaultListener.isDefaultEnabled() ); 88 System.setProperty( "org.jomc.ri.DefaultListener.defaultEnabled", Boolean.toString( false ) ); 89 DefaultListener.setDefaultEnabled( null ); 90 assertFalse( DefaultListener.isDefaultEnabled() ); 91 System.clearProperty( "org.jomc.ri.DefaultListener.defaultEnabled" ); 92 DefaultListener.setDefaultEnabled( null ); 93 } 94 95 @Test 96 public final void testEnabled() throws Exception 97 { 98 DefaultListener.setDefaultEnabled( null ); 99 this.getListener().setEnabled( null ); 100 assertTrue( this.getListener().isEnabled() ); 101 102 DefaultListener.setDefaultEnabled( false ); 103 this.getListener().setEnabled( null ); 104 assertFalse( this.getListener().isEnabled() ); 105 106 DefaultListener.setDefaultEnabled( null ); 107 this.getListener().setEnabled( null ); 108 } 109 110 // SECTION-END 111 // SECTION-START[Constructors] 112 // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> 113 /** Creates a new {@code DefaultListenerTest} instance. */ 114 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" ) 115 public DefaultListenerTest() 116 { 117 // SECTION-START[Default Constructor] 118 super(); 119 // SECTION-END 120 } 121 // </editor-fold> 122 // SECTION-END 123 // SECTION-START[Dependencies] 124 // SECTION-END 125 // SECTION-START[Properties] 126 // SECTION-END 127 // SECTION-START[Messages] 128 // SECTION-END 129 }