URITypeDescriptor extends AbstractTypeDescriptor<URI> { public <X> URI wrap(final X value, final WrapperOptions options) { if (value == null) { return null; } if (String.class.isInstance(value)) { return fromString((String) value); } throw new HibernateException("Unknown wrap conversion requested: " + value.getClass().getName() + " to URI"); } 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 testWrapString() { URI result = URITypeDescriptor.INSTANCE.wrap("http: assertEquals(testUri, result); }
@Test(expected = HibernateException.class) public void testWrapUnknown() { URITypeDescriptor.INSTANCE.wrap(1000, null); }
@Test public void testGenericConstructor() throws Exception { AbstractTypeDescriptor t = new URITypeDescriptor(); URI result = (URI) t.wrap("http: assertEquals(testUri, result); }
@Test public void testWrapNull() { URI result = URITypeDescriptor.INSTANCE.wrap(null, null); assertNull(result); }