### Question:
CloningProvider implements ObjectProvider<T>, Serializable { @Override public T getObject() { try { return ObjectUtils.clone(cloneable); } catch (CloneFailedException e) { throw new ObjectProviderException(e.getMessage(), e.getCause()); } } CloningProvider(T cloneable); @Override T getObject();  }### Answer:
@Test public void testValidCloneable() { final Date now = new Date(); final CloningProvider<Date> provider = new CloningProvider<Date>(now); final Date clone1 = provider.getObject(); assertEquals(now, clone1); assertNotSame(now, clone1); final Date clone2 = provider.getObject(); assertEquals(now, clone2); assertNotSame(now, clone2); assertNotSame(clone2, clone1); }
@Test public void testWithExceptionThrown() { final CloningProvider<ExceptionCloneable> provider = new CloningProvider<ExceptionCloneable>( new ExceptionCloneable()); try { provider.getObject(); fail(); } catch (ObjectProviderException e) { } }
@Test(expected = IllegalArgumentException.class) public void testWithProtectedCloneMethod() { final CloningProvider<ProtectedCloneable> provider = new CloningProvider<ProtectedCloneable>( new ProtectedCloneable()); provider.getObject(); }