assertTrue(exceptionThrown);
assertTrue(message.contains("XQST0049"));  System.out.println("testVariable 5: ========" ); query = "xquery version \"1.0\";\n" + "declare namespace param=\"param\";\n" + "declare function param:f() { $param:a };\n" + "declare variable $param:a {\"a\"};\n" + "param:f()"; result = service.query(query); printResult(result); assertEquals( "XQuery: " + query, 1, result.getSize() ); assertEquals( "XQuery: " + query, "a", ((XMLResource)result.getResource(0)).getContent());
	public void testVariable() {		ResourceSet result;		String query;		XMLResource resu;		boolean exceptionThrown;		String message;						try {			XPathQueryService service =				(XPathQueryService) testCollection.getService(					"XPathQueryService",					"1.0");            System.out.println("testVariable 1: ========" );            query = "xquery version \"1.0\";\n"                                 + "declare namespace param=\"param\";\n"                + "declare variable $param:a {\"a\"};\n"                + "declare function param:a() {$param:a};\n"                + "let $param:a := \"b\" \n"                + "return ($param:a, $param:a)";                        result = service.query(query);            printResult(result);            assertEquals( "XQuery: " + query, 2, result.getSize() );            assertEquals( "XQuery: " + query, "b", ((XMLResource)result.getResource(0)).getContent());            assertEquals( "XQuery: " + query, "b", ((XMLResource)result.getResource(1)).getContent());                        System.out.println("testVariable 2: ========" );			query = "xquery version \"1.0\";\n" 								+ "declare namespace param=\"param\";\n"				+ "declare variable $param:a {\"a\"};\n"				+ "declare function param:a() {$param:a};\n"				+ "let $param:a := \"b\" \n"				+ "return param:a(), param:a()";							result = service.query(query);			printResult(result);			assertEquals( "XQuery: " + query, 2, result.getSize() );			assertEquals( "XQuery: " + query, "a", ((XMLResource)result.getResource(0)).getContent());			assertEquals( "XQuery: " + query, "a", ((XMLResource)result.getResource(1)).getContent());			            System.out.println("testVariable 3: ========" );			query = "declare variable $foo {\"foo1\"};\n"								+ "let $foo := \"foo2\" \n"				+ "for $bar in (1 to 1) \n"				+ "  let $foo := \"foo3\" \n"				+ "  return $foo";							result = service.query(query);			printResult(result);			assertEquals( "XQuery: " + query, 1, result.getSize() );			assertEquals( "XQuery: " + query, "foo3", ((XMLResource)result.getResource(0)).getContent());						try {				exceptionThrown = false;				System.out.println("testVariable 4 ========" );				query = "xquery version \"1.0\";\n" 									+ "declare variable $a {\"1st instance\"};\n"					+ "declare variable $a {\"2nd instance\"};\n"					+ "$a";				result = service.query(query);			} catch (XMLDBException e) {				exceptionThrown = true;				message = e.getMessage();			}			assertTrue(exceptionThrown);					} catch (XMLDBException e) {			System.out.println("testVariable : XMLDBException: "+e);			fail(e.getMessage());		}	}			