class JDOMetaContext implements MetaContext {

    MetaColumn getColumnByQualifiedName(String dataSourceName, String schemaName, String tableName, String columnName) throws MetaException {
        try {
            Query query = pm.newQuery(MColumn.class);
            query.setFilter("name == columnName && "
                    + "table.name == tableName && "
                    + "table.schema.name == schemaName && "
                    + "table.schema.dataSource.name == dataSourceName");
            query.declareParameters("String dataSourceName, String schemaName, String tableName, String columnName");
            query.setUnique(true);

            MColumn mColumn = (MColumn) query.executeWithArray(dataSourceName, schemaName, tableName, columnName);
            if (mColumn == null)
                throw new MetaException("column '" + dataSourceName + "." + schemaName + "." + tableName + "." + columnName + "' does not exist");
            return mColumn;
        } catch (RuntimeException e) {
            throw new MetaException("failed to get column '" + dataSourceName + "." + schemaName + "." + tableName + "." + columnName + "'", e);
        }
    }

}

class JDOMetaContextTest {

    private static final String SCHEMA_NAME;
    private static MemoryDatabase memDbData;
    private final UpdateLoggerFactory ulf;
    private MemoryDatabase memDbMeta;
    private MetaStore metaStore;
    private MetaContext metaContext;
    @Rule
    public ExpectedException thrown;

    @Test
    public void testGetColumnByQualifiedNameFail() throws Exception
    {

        thrown.expect(MetaException.class);
        thrown.expectMessage("does not exist");
        ((JDOMetaContext) metaContext).getColumnByQualifiedName(memDbData.name, SCHEMA_NAME, "employee", "any");
    }

}