@Test public void getButWasNull() throws Exception { final ResultSet rs = mockery.mock(ResultSet.class); final Sequence execution = mockery.sequence("execution"); mockery.checking(new Expectations() {{ one(rs).getString(with(equal("name0here"))); inSequence(execution); will(returnValue("78")); one(rs).wasNull(); inSequence(execution); will(returnValue(true)); }}); assertNull(type.nullSafeGet(rs, new String[] { "name0here" }, null)); mockery.assertIsSatisfied(); }
public final T nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String representation = rs.getString(names[0]); if (rs.wasNull() || representation == null) { return null; } else { return converter().fromString(representation); } }
AbstractStringImmutableType extends AbstractImmutableType implements UserType { public final T nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String representation = rs.getString(names[0]); if (rs.wasNull() || representation == null) { return null; } else { return converter().fromString(representation); } } }
AbstractStringImmutableType extends AbstractImmutableType implements UserType { public final T nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String representation = rs.getString(names[0]); if (rs.wasNull() || representation == null) { return null; } else { return converter().fromString(representation); } }  }
AbstractStringImmutableType extends AbstractImmutableType implements UserType { public final T nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String representation = rs.getString(names[0]); if (rs.wasNull() || representation == null) { return null; } else { return converter().fromString(representation); } }  final T nullSafeGet(ResultSet rs, String[] names, Object owner); @SuppressWarnings("unchecked") @Override final void nullSafeSet(PreparedStatement st, Object value, int index); final int[] sqlTypes(); }
AbstractStringImmutableType extends AbstractImmutableType implements UserType { public final T nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String representation = rs.getString(names[0]); if (rs.wasNull() || representation == null) { return null; } else { return converter().fromString(representation); } }  final T nullSafeGet(ResultSet rs, String[] names, Object owner); @SuppressWarnings("unchecked") @Override final void nullSafeSet(PreparedStatement st, Object value, int index); final int[] sqlTypes();  }