### Question:
SpannerRow implements Row { @Override public <T> T get(int columnIndex, Class<T> returnType) { Value spannerValue = this.values.get(columnIndex); Type spannerType = (Type) this.rowMetadata.getColumnMetadata(columnIndex) .getNativeTypeMetadata(); T decodedValue = codecs.decode(spannerValue, spannerType, returnType); return decodedValue; } SpannerRow(List<Value> values, SpannerRowMetadata rowMetadata); @Override T get(int columnIndex, Class<T> returnType); @Override T get(String columnName, Class<T> returnType); List<Value> getValues(); SpannerRowMetadata getRowMetadata();  }### Answer:
@Test public void testOutOfBoundsIndex() { SpannerRow row = new SpannerRow( new ArrayList<>(), this.rowMetadata); assertThatThrownBy(() -> row.get(4, String.class)) .isInstanceOf(IndexOutOfBoundsException.class); }
@Test public void testInvalidColumnLabel() { SpannerRow row = new SpannerRow( new ArrayList<>(), this.rowMetadata); assertThatThrownBy(() -> row.get("foobar", String.class)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("The column name foobar does not exist for the Spanner row."); }
@Test public void testIndexingIntoColumns() { SpannerRowMetadata rowMetadata = createRowMetadata(TypeCode.STRING, TypeCode.INT64, TypeCode.BOOL); List<Value> rawSpannerRow = createRawSpannerRow("Hello", 25L, true); SpannerRow row = new SpannerRow(rawSpannerRow, rowMetadata); assertThat(row.get("column_2", Boolean.class)).isEqualTo(true); assertThat(row.get("column_0", String.class)).isEqualTo("Hello"); assertThat(row.get(1, Long.class)).isEqualTo(25L); }