### Question:
LDAPInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (LDAPInputMeta) smi; data = (LDAPInputData) sdi; if ( super.init( smi, sdi ) ) { data.rownr = 1L; data.multi_valuedFieldSeparator = environmentSubstitute( meta.getMultiValuedSeparator() ); data.nrfields = meta.getInputFields().length; data.staticFilter = environmentSubstitute( meta.getFilterString() ); data.staticSearchBase = environmentSubstitute( meta.getSearchBase() ); data.dynamic = ( meta.isDynamicSearch() || meta.isDynamicFilter() ); try { connectServerLdap(); return true; } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "LDAPInput.ErrorInit", e.toString() ) ); stopAll(); setErrors( 1 ); } } return false; } LDAPInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
    Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi );  }### Answer:
@Test public void testRowProcessing() throws Exception { LDAPInput ldapInput = new LDAPInput( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); LDAPInputData data = new LDAPInputData(); LDAPInputMeta meta = mockMeta(); LDAPInputField[] fields = new LDAPInputField[] { new LDAPInputField( "dn" ), new LDAPInputField( "cn" ), new LDAPInputField( "role" ) }; int sortedField = 1; fields[sortedField].setSortedKey( true ); when( meta.getInputFields() ).thenReturn( fields ); when( meta.getProtocol() ).thenReturn( LdapMockProtocol.getName() ); when( meta.getHost() ).thenReturn( "host.mock" ); when( meta.getDerefAliases() ).thenReturn( "never" ); when( meta.getReferrals() ).thenReturn( "ignore" ); LdapMockProtocol.setup(); try { assertTrue( "Input Initialization Failed", ldapInput.init( meta, data ) ); assertEquals( "Field not marked as sorted", 1, data.connection.getSortingAttributes().size() ); assertEquals( "Field not marked as sorted", data.attrReturned[sortedField], data.connection.getSortingAttributes().get( 0 ) ); assertNotNull( data.attrReturned[sortedField] ); } finally { LdapMockProtocol.cleanup(); } }