URITypeDescriptor extends AbstractTypeDescriptor<URI> { @SuppressWarnings({"unchecked"}) public <X> X unwrap(final URI value, final Class<X> type, final WrapperOptions options) { if (value == null) { return null; } if (String.class.isAssignableFrom(type)) { return (X) toString(value); } throw new HibernateException( "Unknown unwrap conversion requested: URI to " + type.getName() ); } URITypeDescriptor(); String toString(final URI value); URI fromString(final String string); @SuppressWarnings({"unchecked"}) X unwrap(final URI value,
                        final Class<X> type,
                        final WrapperOptions options); URI wrap(final X value, final WrapperOptions options); static final URITypeDescriptor INSTANCE; }
@Test public void testUnwrapNull() { String result = URITypeDescriptor.INSTANCE.unwrap(null, String.class, null); assertNull(result); }
@Test public void testUnwrapString() { String result = URITypeDescriptor.INSTANCE.unwrap(testUri, String.class, null); assertEquals("http: }
@Test(expected = HibernateException.class) public void testUnwrapInvalid() { URITypeDescriptor.INSTANCE.unwrap(testUri, Integer.class, null); }