@@ -0,0 +1,2730 @@
+package org.exist.xquery;%0A%0Aimport org.exist.test.ExistXmldbEmbeddedServer;%0Aimport org.junit.ClassRule;%0Aimport org.junit.Test;%0Aimport static org.junit.Assert.*;%0Aimport org.xmldb.api.base.XMLDBException;%0Aimport org.xmldb.api.modules.XQueryService;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class UnknownAtomicTypeTest %7B%0A    @ClassRule%0A    public static final ExistXmldbEmbeddedServer existEmbeddedServer = new ExistXmldbEmbeddedServer(true, true, true);%0A%0A    @Test%0A    public void letVariable() throws XMLDBException %7B%0A        final String query = %22let $x as y := 0 return $x%22;%0A        final String error = %22err:XPST0051 Unknown simple type y %5Bat line 1, column 11%5D%22;%0A        assertCompilationError(query, error);%0A    %7D%0A%0A    @Test%0A    public void functionReturnType() throws XMLDBException %7B%0A        final String query = %22function () as y %7B () %7D%22;%0A        final String error = %22err:XPST0051 Unknown simple type y %5Bat line 1, column 16%5D%22;%0A        assertCompilationError(query, error);%0A    %7D%0A%0A    @Test%0A    public void functionParameterType() throws XMLDBException %7B%0A        final String query = %22function ($x as y) %7B $x %7D%22;%0A        final String error = %22err:XPST0051 Unknown simple type y %5Bat line 1, column 17%5D%22;%0A        assertCompilationError(query, error);%0A    %7D%0A%0A    @Test%0A    public void instanceOf() throws XMLDBException %7B%0A        final String query = %221 instance of y%22;%0A        final String error = %22err:XPST0051 Unknown simple type y %5Bat line 1, column 15%5D%22;%0A        assertCompilationError(query, error);%0A    %7D%0A%0A    @Test%0A    public void treatAs() throws XMLDBException %7B%0A        final String query = %221 treat as y%22;%0A        final String error = %22err:XPST0051 Unknown simple type y %5Bat line 1, column 12%5D%22;%0A        assertCompilationError(query, error);%0A    %7D%0A%0A    @Test%0A    public void castAs() throws XMLDBException %7B%0A        final String query = %221 cast as y%22;%0A        final String error = %22err:XPST0051 Unknown simple type y %5Bat line 1, column 11%5D%22;%0A        assertCompilationError(query, error);%0A    %7D%0A%0A    @Test%0A    public void castableAs() throws XMLDBException %7B%0A        final String query = %221 castable as y%22;%0A        final String error = %22err:XPST0051 Unknown simple type y %5Bat line 1, column 15%5D%22;%0A        assertCompilationError(query, error);%0A    %7D%0A%0A    private void assertCompilationError(final String query, final String error) throws XMLDBException %7B%0A        final XQueryService service = (XQueryService)existEmbeddedServer.getRoot().getService(%22XQueryService%22, %221.0%22);%0A%0A        try %7B%0A            service.compile(query);%0A            fail(%22no XMLDBException was thrown during compilation.%22);%0A        %7D catch (XMLDBException ex) %7B%0A            assertEquals( error, ex.getMessage() );%0A        %7D%0A    %7D%0A%7D%0A

add jUnit testsuite for #3518