@Before public void beforeEach() throws Exception { MockitoAnnotations.initMocks(this); when(results.getColumnNames()).thenReturn(columnNames); when(results.getSelectorNames()).thenReturn(tableNames); when(extendedResults.getColumnNames()).thenReturn(columnNames); when(extendedResults.getSelectorNames()).thenReturn(tableNames); when(extendedResults.getColumnTypes()).thenReturn(typeNames); // Set up the node types ... addPropDefn("typeA", "propA", true); addPropDefn("typeA", "propC", false); addPropDefn("typeB", "propB", false); addPropDefn("typeA", "propE", false); // Set up the connection information ... when(info.getWorkspaceName()).thenReturn("workspaceName"); when(info.getRepositoryName()).thenReturn("repositoryName"); // Set up the mock connection ... when(connection.info()).thenReturn(info); // Set up the metadata objects ... metadata = new JcrResultSetMetaData(connection, results); extMetadata = new JcrResultSetMetaData(connection, extendedResults); }