}
}
public void testXQConnectionConnect() {
try {
XQConnection connection = new XQConnection();
ILogger mockLogger = mock( ILogger.class );
connection.setLogger( mockLogger );
Properties properties = null;
boolean isConnected = connection.connect( properties );
assertTrue( isConnected );
properties = new Properties();
isConnected = connection.connect( properties );
assertTrue( isConnected );
properties.setProperty( IPentahoConnection.QUERY_KEY, StringUtils.EMPTY );
isConnected = connection.connect( properties );
assertTrue( isConnected );
properties.setProperty( IPentahoConnection.QUERY_KEY, TEST_QUERY );
isConnected = connection.connect( properties );
assertTrue( isConnected );
StaticQueryContext mockContext = mock( StaticQueryContext.class );
when( mockContext.compileQuery( TEST_QUERY ) ).thenThrow( new XPathException( "Test XPathException" ) );
connection.sqc = mockContext;
isConnected = connection.connect( properties );
assertFalse( isConnected );
} catch ( Exception e ) {
e.printStackTrace();
fail( "Should not throw Exception" );
}