### Question:
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();  }### Answer:
@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(); }
@Test public void getHadData() 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("98")); one(rs).wasNull(); inSequence(execution); will(returnValue(false)); }}); Object value = type.nullSafeGet(rs, new String[] { "name0here" }, null); assertNotNull(value); assertEquals(98, value); mockery.assertIsSatisfied(); }