### Question:
SpannerRowMetadata implements RowMetadata { @Override public ColumnMetadata getColumnMetadata(int index) { return this.columnMetadatas.get(index); } SpannerRowMetadata(ResultSetMetadata resultSetMetadata); @Override ColumnMetadata getColumnMetadata(int index); @Override ColumnMetadata getColumnMetadata(String identifier); @Override Iterable<? extends ColumnMetadata> getColumnMetadatas(); @Override Collection<String> getColumnNames();  }### Answer:
@Test public void testHandleMissingColumn() { SpannerRowMetadata metadata = new SpannerRowMetadata(ResultSetMetadata.newBuilder().build()); assertThatThrownBy(() -> metadata.getColumnMetadata("columnName")) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("The column name columnName does not exist for the Spanner row."); }
@Test public void testHandleOutOfBoundsIndex() { SpannerRowMetadata metadata = new SpannerRowMetadata(ResultSetMetadata.newBuilder().build()); assertThatThrownBy(() -> metadata.getColumnMetadata(4)) .isInstanceOf(IndexOutOfBoundsException.class); }
@Test public void testSpannerRowMetadataRetrieval() { ResultSetMetadata resultSetMetadata = buildResultSetMetadata( TypeCode.INT64, TypeCode.STRING, TypeCode.BOOL); SpannerRowMetadata metadata = new SpannerRowMetadata(resultSetMetadata); ColumnMetadata column1 = metadata.getColumnMetadata("column_1"); assertThat(column1.getNativeTypeMetadata()) .isEqualTo(Type.newBuilder().setCode(TypeCode.STRING).build()); ColumnMetadata column0 = metadata.getColumnMetadata(0); assertThat(column0.getName()).isEqualTo("column_0"); assertThat(column0.getNativeTypeMetadata()).isEqualTo( Type.newBuilder().setCode(TypeCode.INT64).build()); }