### Question:
TransLineageHolderMap { public IMetaverseBuilder getMetaverseBuilder( Trans trans ) { if ( trans != null ) { if ( trans.getParentJob() == null && trans.getParentTrans() == null ) { IMetaverseBuilder builder = this.getLineageHolder( trans ).getMetaverseBuilder(); if ( builder == null ) { return getDefaultMetaverseBuilder(); } else { return builder; } } else { if ( trans.getParentJob() != null ) { return JobLineageHolderMap.getInstance().getMetaverseBuilder( trans.getParentJob() ); } else { return this.getMetaverseBuilder( trans.getParentTrans() ); } } } return null; } private  TransLineageHolderMap(); static TransLineageHolderMap getInstance(); LineageHolder getLineageHolder( Trans t ); void putLineageHolder( Trans t, LineageHolder holder ); LineageHolder removeLineageHolderImpl( final Trans t  ); LineageHolder removeLineageHolder( Trans t  ); IMetaverseBuilder getMetaverseBuilder( Trans trans );  }### Answer:
@Test public void testGetMetaverseBuilder() throws Exception { assertNull( transLineageHolderMap.getMetaverseBuilder( null ) ); Trans trans = mock( Trans.class ); when( trans.getParentJob() ).thenReturn( null ); when( trans.getParentTrans() ).thenReturn( null ); mockHolder.setMetaverseBuilder( mockBuilder ); transLineageHolderMap.putLineageHolder( trans, mockHolder ); IMetaverseBuilder builder = transLineageHolderMap.getMetaverseBuilder( trans ); assertNotNull( builder ); Trans parentTrans = mock( Trans.class ); when( parentTrans.getParentJob() ).thenReturn( null ); when( parentTrans.getParentTrans() ).thenReturn( null ); when( trans.getParentTrans() ).thenReturn( parentTrans ); LineageHolder mockParentHolder = spy( new LineageHolder() ); IMetaverseBuilder mockParentBuilder = mock( IMetaverseBuilder.class ); transLineageHolderMap.putLineageHolder( parentTrans, mockParentHolder ); mockParentHolder.setMetaverseBuilder( null ); assertEquals( defaultBuilder, transLineageHolderMap.getMetaverseBuilder( trans ) ); mockParentHolder.setMetaverseBuilder( mockParentBuilder ); builder = transLineageHolderMap.getMetaverseBuilder( trans ); assertNotNull( builder ); }