1 /* 2 * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved. 3 * 4 * This software is open source. 5 * See the bottom of this file for the licence. 6 * 7 * $Id: TestProcessingInstruction.java,v 1.3 2004/06/25 08:03:47 maartenc Exp $ 8 */ 9 10 package org.dom4j; 11 12 import java.util.Map; 13 14 import junit.framework.*; 15 import junit.textui.TestRunner; 16 17 /*** 18 * @author kralik 19 * @author Maarten Coene 20 */ 21 public class TestProcessingInstruction extends TestCase { 22 23 public static void main( String[] args ) { 24 TestRunner.run( suite() ); 25 } 26 27 public static Test suite() { 28 return new TestSuite( TestProcessingInstruction.class ); 29 } 30 31 public TestProcessingInstruction(String name) { 32 super(name); 33 } 34 35 public final void testParseValues() { 36 ProcessingInstruction pi= 37 DocumentHelper.createProcessingInstruction("pi", " abc='123' def=\"2!=3\" ghi=' 4 = '"); 38 39 Map values = pi.getValues(); 40 assertEquals(3, values.size()); 41 assertEquals("123", pi.getValue("abc")); 42 assertEquals("2!=3", pi.getValue("def")); 43 assertEquals(" 4 = ", pi.getValue("ghi")); 44 } 45 46 public void testBug787428() { 47 ProcessingInstruction pi = 48 DocumentHelper.createProcessingInstruction("merge", "xpath=\"/abc/cde[@id='qqq']\""); 49 50 assertEquals("/abc/cde[@id='qqq']", pi.getValue("xpath")); 51 } 52 53 } 54 55 56 57 /* 58 * Redistribution and use of this software and associated documentation 59 * ("Software"), with or without modification, are permitted provided 60 * that the following conditions are met: 61 * 62 * 1. Redistributions of source code must retain copyright 63 * statements and notices. Redistributions must also contain a 64 * copy of this document. 65 * 66 * 2. Redistributions in binary form must reproduce the 67 * above copyright notice, this list of conditions and the 68 * following disclaimer in the documentation and/or other 69 * materials provided with the distribution. 70 * 71 * 3. The name "DOM4J" must not be used to endorse or promote 72 * products derived from this Software without prior written 73 * permission of MetaStuff, Ltd. For written permission, 74 * please contact dom4j-info@metastuff.com. 75 * 76 * 4. Products derived from this Software may not be called "DOM4J" 77 * nor may "DOM4J" appear in their names without prior written 78 * permission of MetaStuff, Ltd. DOM4J is a registered 79 * trademark of MetaStuff, Ltd. 80 * 81 * 5. Due credit should be given to the DOM4J Project - 82 * http://www.dom4j.org 83 * 84 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS 85 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT 86 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 87 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 88 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 89 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 90 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 91 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 92 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 93 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 94 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 95 * OF THE POSSIBILITY OF SUCH DAMAGE. 96 * 97 * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved. 98 * 99 * $Id: TestProcessingInstruction.java,v 1.3 2004/06/25 08:03:47 maartenc Exp $ 100 */