### Question:
TableOutput extends BaseTransform<TableOutputMeta, TableOutputData> implements ITransform<TableOutputMeta, TableOutputData> { void truncateTable() throws HopDatabaseException { if ( !meta.isPartitioningEnabled() && !meta.isTableNameInField() ) { if ( meta.truncateTable() && ( ( getCopy() == 0 ) || !Utils.isEmpty( getPartitionId() ) ) ) { data.db.truncateTable( environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta .getTableName() ) ); } } } TableOutput( TransformMeta transformMeta, TableOutputMeta meta, TableOutputData data, int copyNr, PipelineMeta pipelineMeta,
                      Pipeline pipeline ); boolean processRow(); boolean isRowLevel(); boolean init(); void dispose();  }### Answer:
@Test public void testTruncateTable_off() throws Exception { tableOutputSpy.truncateTable(); verify( db, never() ).truncateTable( anyString(), anyString() ); }
@Test public void testTruncateTable_on() throws Exception { when( tableOutputMeta.truncateTable() ).thenReturn( true ); when( tableOutputSpy.getCopy() ).thenReturn( 0 ); tableOutputSpy.truncateTable(); verify( db ).truncateTable( anyString(), anyString() ); }
@Test public void testTruncateTable_on_PartitionId() throws Exception { when( tableOutputMeta.truncateTable() ).thenReturn( true ); when( tableOutputSpy.getCopy() ).thenReturn( 1 ); when( tableOutputSpy.getPartitionId() ).thenReturn( "partition id" ); tableOutputSpy.truncateTable(); verify( db ).truncateTable( anyString(), anyString() ); }