### Question:
UnitOfWorkTemplate { @SuppressWarnings( "unchecked" ) public RESULT withModule( Module module ) throws ThrowableType, UnitOfWorkCompletionException { int loop = 0; ThrowableType ex = null; do { UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( usecase ); try { RESULT result = withUnitOfWork( uow ); if( complete ) { try { uow.complete(); return result; } catch( ConcurrentEntityModificationException e ) { ex = (ThrowableType) e; } } } catch( Throwable e ) { ex = (ThrowableType) e; } finally { uow.discard(); } } while( loop++ < retries ); throw ex; } protected  UnitOfWorkTemplate(); protected  UnitOfWorkTemplate( int retries, boolean complete ); protected  UnitOfWorkTemplate( Usecase usecase, int retries, boolean complete ); @SuppressWarnings( "unchecked" ) RESULT withModule( Module module );  }### Answer:
@Test public void testTemplate() throws UnitOfWorkCompletionException { new UnitOfWorkTemplate<Void, RuntimeException>() { @Override protected Void withUnitOfWork( UnitOfWork uow ) throws RuntimeException { new EntityBuilderTemplate<TestEntity>( TestEntity.class ) { @Override protected void build( TestEntity prototype ) { prototype.name().set( "Rickard" ); } }.newInstance( module.instance() ); return null; } }.withModule( module.instance() ); }