### Question:
MappedQueryResult implements QueryResult<T> { @Override public T one() { Iterator<Row> iterator = rows.iterator(); if(iterator.hasNext()) { T result = mapper.map(iterator.next()); mapper.mappingComplete(); return result; } return null; } MappedQueryResult(Iterable<Row> rows, RowMapper<T> mapper);  MappedQueryResult(ResultSet resultSet, RowMapper<T> mapper); @Override Iterator<T> iterator(); @Override List<T> list(); @Override T one(); @Override Stream<T> stream();  }### Answer:
@Test public void testOne() { withSession(session -> { MappedQueryResult<String> resultSet = new MappedQueryResult<>(session.execute("select id, value from test"), row -> row.getString(1)); assertEquals("one", resultSet.one()); }); }
@Test public void testOneWithNoResults() { withSession(session -> { MappedQueryResult<String> resultSet = new MappedQueryResult<>(session.execute("select id, value from test where id = 5"), row -> row.getString(1)); assertNull(resultSet.one()); }); }