@Test public void memberNameBasedValueRetrieval() throws Exception { Outline<TestBean> outline = OutlineBuilder.DEFAULT.build(TestBean.class); ResultSet resultSet = mock(ResultSet.class); RowImpl row = new RowImpl(resultSet); when(resultSet.getByte("test_beans.property_name")).thenReturn((byte) 26); assertEquals(26, row.get(outline.member(m -> m.getPropertyName())).asByte()); when(resultSet.getBytes("test_beans.property_name")).thenReturn("test".getBytes()); assertArrayEquals("test".getBytes(), row.get(outline.member(m -> m.getPropertyName())).asByteArray()); when(resultSet.getInt("test_beans.property_name")).thenReturn((int) 'a'); assertEquals('a', row.get(outline.member(m -> m.getPropertyName())).asCharacter()); when(resultSet.getDouble("test_beans.property_name")).thenReturn(1.23); assertEquals(1.23, row.get(outline.member(m -> m.getPropertyName())).asDouble(), 0.001); LocalDateTime now = LocalDateTime.now(); when(resultSet.getTimestamp("test_beans.property_name")).thenReturn(new Timestamp(Times.toEpochMillis(now))); assertEquals(now, row.get(outline.member(m -> m.getPropertyName())).asLocalDateTime()); when(resultSet.getLong("test_beans.property_name")).thenReturn(156l); assertEquals(156l, row.get(outline.member(m -> m.getPropertyName())).asLong()); when(resultSet.getInt("test_beans.property_name")).thenReturn(178); assertEquals(178, row.get(outline.member(m -> m.getPropertyName())).asInteger()); when(resultSet.getFloat("test_beans.property_name")).thenReturn(8.012f); assertEquals(8.012f, row.get(outline.member(m -> m.getPropertyName())).asFloat(), 0.001); when(resultSet.getBoolean("test_beans.property_name")).thenReturn(true); assertEquals(true, row.get(outline.member(m -> m.getPropertyName())).asBoolean()); when(resultSet.getShort("test_beans.property_name")).thenReturn((short) 17); assertEquals((short) 17, row.get(outline.member(m -> m.getPropertyName())).asShort()); when(resultSet.getString("test_beans.property_name")).thenReturn("test"); assertEquals("test", row.get(outline.member(m -> m.getPropertyName())).asString()); }
@Override public Value get(int index) { return new IndexedColumnValue(index); }
RowImpl implements Row { @Override public Value get(int index) { return new IndexedColumnValue(index); } }
RowImpl implements Row { @Override public Value get(int index) { return new IndexedColumnValue(index); } RowImpl(ResultSet resultSet); }
RowImpl implements Row { @Override public Value get(int index) { return new IndexedColumnValue(index); } RowImpl(ResultSet resultSet); @Override Value get(int index); @Override Value get(String name); @Override Value get(String table, String name); @Override Value get(Member member); @Override int size(); }
RowImpl implements Row { @Override public Value get(int index) { return new IndexedColumnValue(index); } RowImpl(ResultSet resultSet); @Override Value get(int index); @Override Value get(String name); @Override Value get(String table, String name); @Override Value get(Member member); @Override int size();  }