OracleRefNormaliser implements TypeTransformer { @Override public Object transform(Object o) throws SQLException { if (o == null) return null; if (!(o instanceof ResultSet)) throw new UnsupportedOperationException( "OracleRefNormaliser cannot work with " + o.getClass()); ResultSet rs = (ResultSet) o; OracleCachedRowSet ocrs = new OracleCachedRowSet(); ocrs.populate(rs); return ocrs; }  @Override Object transform(Object o);  }
@Test public void shouldReturnNullIfGivenNull() throws SQLException { assertNull(new OracleRefNormaliser().transform(null)); }
@Test public void shouldThrowCorrectExceptionIfNotGivenAResultSet() throws SQLException { expectedEx.expect(UnsupportedOperationException.class); expectedEx.expectMessage("OracleRefNormaliser cannot work with class java.lang.String"); new OracleRefNormaliser().transform("Any Old Object"); }