View Javadoc
1 /*** 2 * Redistribution and use of this software and associated documentation 3 * ("Software"), with or without modification, are permitted provided 4 * that the following conditions are met: 5 * 6 * 1. Redistributions of source code must retain copyright 7 * statements and notices. Redistributions must also contain a 8 * copy of this document. 9 * 10 * 2. Redistributions in binary form must reproduce the 11 * above copyright notice, this list of conditions and the 12 * following disclaimer in the documentation and/or other 13 * materials provided with the distribution. 14 * 15 * 3. The name "Exolab" must not be used to endorse or promote 16 * products derived from this Software without prior written 17 * permission of Exoffice Technologies. For written permission, 18 * please contact tma@netspace.net.au. 19 * 20 * 4. Products derived from this Software may not be called "Exolab" 21 * nor may "Exolab" appear in their names without prior written 22 * permission of Exoffice Technologies. Exolab is a registered 23 * trademark of Exoffice Technologies. 24 * 25 * 5. Due credit should be given to the Exolab Project 26 * (http://www.exolab.org/). 27 * 28 * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS 29 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT 30 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 31 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 32 * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 33 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 34 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 35 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 37 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 39 * OF THE POSSIBILITY OF SUCH DAMAGE. 40 * 41 * Copyright 2001-2004 (C) Exoffice Technologies Inc. All Rights Reserved. 42 * 43 * $Id: AndOperatorTest.java,v 1.4 2004/02/03 21:52:11 tanderson Exp $ 44 */ 45 package org.exolab.jmscts.test.selector; 46 47 import junit.framework.Test; 48 49 import org.exolab.jmscts.core.TestCreator; 50 51 52 /*** 53 * This class tests selectors containing the AND operator. 54 * 55 * @author <a href="mailto:tma@netspace.net.au">Tim Anderson</a> 56 * @version $Revision: 1.4 $ 57 * @see AbstractSelectorTestCase 58 * @jmscts.message Message 59 */ 60 public class AndOperatorTest extends AbstractSelectorTestCase { 61 62 /*** 63 * Create an instance of this class for a specific test case, testing 64 * against all delivery types 65 * 66 * @param name the name of test case 67 */ 68 public AndOperatorTest(String name) { 69 super(name); 70 } 71 72 /*** 73 * Sets up the test suite 74 * 75 * @return an instance of this class that may be run by 76 * {@link org.exolab.jmscts.core.JMSTestRunner} 77 */ 78 public static Test suite() { 79 return TestCreator.createSendReceiveTest(AndOperatorTest.class); 80 } 81 82 /*** 83 * Verifies that the selector <code>true and true</code> selects 84 * all messages 85 * 86 * @jmscts.requirement selector.operator.and 87 * @jmscts.requirement selector.expression 88 * @throws Exception for any error 89 */ 90 public void testAnd1() throws Exception { 91 checkSelector("true and true", true); 92 } 93 94 /*** 95 * Verifies that the selector <code>true and false</code> selects 96 * no messages 97 * 98 * @jmscts.requirement selector.operator.and 99 * @jmscts.requirement selector.expression 100 * @throws Exception for any error 101 */ 102 public void testAnd2() throws Exception { 103 checkSelector("true and false", false); 104 } 105 106 /*** 107 * Verifies that the selector <code>false and true</code> selects 108 * no messages 109 * 110 * @jmscts.requirement selector.operator.and 111 * @jmscts.requirement selector.expression 112 * @throws Exception for any error 113 */ 114 public void testAnd3() throws Exception { 115 checkSelector("false and true", false); 116 } 117 118 /*** 119 * Verifies that the selector <code>false and false</code> selects 120 * no messages 121 * 122 * @jmscts.requirement selector.operator.and 123 * @jmscts.requirement selector.expression 124 * @throws Exception for any error 125 */ 126 public void testAnd4() throws Exception { 127 checkSelector("false and false", false); 128 } 129 130 /*** 131 * Verifies that the selector <code>true AND true</code> selects 132 * all messages 133 * 134 * @jmscts.requirement selector.operator.and 135 * @jmscts.requirement selector.expression 136 * @jmscts.requirement selector.reservedwords.case 137 * @throws Exception for any error 138 */ 139 public void testAndCase() throws Exception { 140 checkSelector("true AND true", true); 141 } 142 143 /*** 144 * Verifies that the selector <code>true and dummy</code> selects 145 * no messages, for the unset property 'dummy' 146 * 147 * @jmscts.requirement selector.operator.and 148 * @jmscts.requirement selector.expression 149 * @jmscts.requirement selector.values.null 150 * @throws Exception for any error 151 */ 152 public void testUnsetProperty1() throws Exception { 153 checkSelector("true and dummy", false); 154 } 155 156 /*** 157 * Verifies that the selector <code>false and dummy</code> selects 158 * no messages, for the unset property 'dummy' 159 * 160 * @jmscts.requirement selector.operator.and 161 * @jmscts.requirement selector.expression 162 * @jmscts.requirement selector.values.null 163 * @throws Exception for any error 164 */ 165 public void testUnsetProperty2() throws Exception { 166 checkSelector("false and dummy", false); 167 } 168 169 /*** 170 * Verifies that the selector <code>dummy and true</code> selects 171 * no messages, for the unset property 'dummy' 172 * 173 * @jmscts.requirement selector.operator.and 174 * @jmscts.requirement selector.expression 175 * @jmscts.requirement selector.values.null 176 * @throws Exception for any error 177 */ 178 public void testUnsetProperty3() throws Exception { 179 checkSelector("dummy and true", false); 180 } 181 182 /*** 183 * Verifies that the selector <code>dummy and false</code> selects 184 * no messages, for the unset property 'dummy' 185 * 186 * @jmscts.requirement selector.operator.and 187 * @jmscts.requirement selector.expression 188 * @jmscts.requirement selector.values.null 189 * @throws Exception for any error 190 */ 191 public void testUnsetProperty4() throws Exception { 192 checkSelector("dummy and false", false); 193 } 194 195 /*** 196 * Verifies that the selector <code>dummy and dummy</code> selects 197 * no messages, for the unset property 'dummy' 198 * 199 * @jmscts.requirement selector.operator.and 200 * @jmscts.requirement selector.expression 201 * @jmscts.requirement selector.values.null 202 * @throws Exception for any error 203 */ 204 public void testUnsetProperty5() throws Exception { 205 checkSelector("dummy and dummy", false); 206 } 207 208 /*** 209 * Verifies that the selector <code>and</code> throws 210 * InvalidSelectorException 211 * 212 * @jmscts.requirement selector.validation 213 * @throws Exception for any error 214 */ 215 public void testInvalidAnd1() throws Exception { 216 checkInvalidSelector("and"); 217 } 218 219 /*** 220 * Verifies that the selector <code>true and</code> throws 221 * InvalidSelectorException 222 * 223 * @jmscts.requirement selector.validation 224 * @throws Exception for any error 225 */ 226 public void testInvalidAnd2() throws Exception { 227 checkInvalidSelector("true and"); 228 } 229 230 /*** 231 * Verifies that the selector <code>false and</code> throws 232 * InvalidSelectorException 233 * 234 * @jmscts.requirement selector.validation 235 * @throws Exception for any error 236 */ 237 public void testInvalidAnd3() throws Exception { 238 checkInvalidSelector("and true"); 239 } 240 241 }

This page was automatically generated by Maven