1 /*
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 package sax;
25
26 import org.testng.Assert;
27 import org.testng.annotations.Test;
28 import org.xml.sax.ext.Attributes2Impl;
29
30 /*
31 * @summary Test Attributes2Impl.
32 */
33 public class Attributes2ImplTest {
34
35 @Test
36 public void test01() {
37 System.out.println("===in test01()===");
38 Attributes2Impl impl = new Attributes2Impl();
39 impl.addAttribute("http://www.cars.com/xml", "attr1", "Qname1", "type", "value");
40 impl.addAttribute("http://www.cars.com/xml", "attr2", "Qname2", "type", "value");
41 impl.addAttribute("http://www.cars.com/xml", "attr3", "Qname3", "type", "value");
42
43 Assert.assertTrue(impl.isDeclared(0));
44 impl.setDeclared(0, false);
45 Assert.assertFalse(impl.isDeclared(0));
46
47 Assert.assertTrue(impl.isDeclared("Qname2"));
48 impl.setDeclared(1, false);
49 Assert.assertFalse(impl.isDeclared("Qname2"));
50
51 Assert.assertTrue(impl.isDeclared("http://www.cars.com/xml", "attr3"));
52 impl.setDeclared(2, false);
|
1 /*
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 package sax;
25
26 import org.testng.Assert;
27 import org.testng.annotations.Listeners;
28 import org.testng.annotations.Test;
29 import org.xml.sax.ext.Attributes2Impl;
30
31 /*
32 * @summary Test Attributes2Impl.
33 */
34 @Listeners({jaxp.library.BasePolicy.class})
35 public class Attributes2ImplTest {
36
37 @Test
38 public void test01() {
39 System.out.println("===in test01()===");
40 Attributes2Impl impl = new Attributes2Impl();
41 impl.addAttribute("http://www.cars.com/xml", "attr1", "Qname1", "type", "value");
42 impl.addAttribute("http://www.cars.com/xml", "attr2", "Qname2", "type", "value");
43 impl.addAttribute("http://www.cars.com/xml", "attr3", "Qname3", "type", "value");
44
45 Assert.assertTrue(impl.isDeclared(0));
46 impl.setDeclared(0, false);
47 Assert.assertFalse(impl.isDeclared(0));
48
49 Assert.assertTrue(impl.isDeclared("Qname2"));
50 impl.setDeclared(1, false);
51 Assert.assertFalse(impl.isDeclared("Qname2"));
52
53 Assert.assertTrue(impl.isDeclared("http://www.cars.com/xml", "attr3"));
54 impl.setDeclared(2, false);
|