DbTable implements DbObject { public DbParameterAccessor getDbParameterAccessor(String columnName, Direction expectedDirection) { String normalisedName = NameNormaliser.normaliseName(columnName); DbParameterAccessor accessor = columns.get(normalisedName); if (null == accessor) { throw new RuntimeException( "No such database column or parameter: '" + normalisedName + "'"); } if (accessor.hasDirection(INPUT) && expectedDirection == OUTPUT) { accessor = dbEnvironment .createAutogeneratedPrimaryKeyAccessor(accessor); } return accessor; } DbTable(DBEnvironment dbEnvironment, String tableName); StatementExecution buildPreparedStatement(
            DbParameterAccessor[] accessors); DbParameterAccessor getDbParameterAccessor(String columnName,
            Direction expectedDirection);  }
@Test public void exceptionWhenAccessingNonexistentColumn() throws SQLException { DBEnvironment env = mock(DBEnvironment.class); when(env.getAllColumns("mytable")).thenReturn(columns("some_column")); expectedEx.expect(RuntimeException.class); expectedEx.expectMessage("No such database column or parameter: 'nonexistent_column'"); new DbTable(env, "mytable").getDbParameterAccessor("nonexistent_column", INPUT); }