|
| 1 | +/* |
| 2 | + * eXist-db Open Source Native XML Database |
| 3 | + * Copyright (C) 2001 The eXist-db Authors |
| 4 | + * |
| 5 | + |
| 6 | + * http://www.exist-db.org |
| 7 | + * |
| 8 | + * This library is free software; you can redistribute it and/or |
| 9 | + * modify it under the terms of the GNU Lesser General Public |
| 10 | + * License as published by the Free Software Foundation; either |
| 11 | + * version 2.1 of the License, or (at your option) any later version. |
| 12 | + * |
| 13 | + * This library is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | + * Lesser General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU Lesser General Public |
| 19 | + * License along with this library; if not, write to the Free Software |
| 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | + */ |
| 22 | +package org.exist.xquery.functions.fn; |
| 23 | + |
| 24 | +import com.googlecode.junittoolbox.ParallelRunner; |
| 25 | +import org.exist.test.ExistXmldbEmbeddedServer; |
| 26 | +import org.exist.xquery.XPathException; |
| 27 | +import org.junit.ClassRule; |
| 28 | +import org.junit.Test; |
| 29 | +import org.junit.runner.RunWith; |
| 30 | +import org.xmldb.api.base.ResourceSet; |
| 31 | +import org.xmldb.api.base.XMLDBException; |
| 32 | + |
| 33 | +import static org.junit.Assert.assertEquals; |
| 34 | + |
| 35 | +/** |
| 36 | + * @author Dannes Wessels |
| 37 | + */ |
| 38 | +@RunWith(ParallelRunner.class) |
| 39 | +public class FunDocumentUriTest { |
| 40 | + |
| 41 | + @ClassRule |
| 42 | + public static final ExistXmldbEmbeddedServer existEmbeddedServer = new ExistXmldbEmbeddedServer(true, true, true); |
| 43 | + |
| 44 | + @Test |
| 45 | + public void testFnFunDocumentUri() { |
| 46 | + |
| 47 | + try { |
| 48 | + final ResourceSet resourceSet = existEmbeddedServer.executeQuery( |
| 49 | + "declare context item := 'a'; document-uri()"); |
| 50 | + |
| 51 | + } catch (XMLDBException ex) { |
| 52 | + XPathException cause = (XPathException) ex.getCause(); |
| 53 | + assertEquals("XPTY0004", cause.getErrorCode().getErrorQName().getLocalPart()); |
| 54 | + } |
| 55 | + } |
| 56 | +} |
0 commit comments