use of org.pentaho.di.trans.steps.streamlookup.StreamLookupMeta in project pentaho-kettle by pentaho.
the class TransMetaTest method testGetPreviousStepsWhenStreamLookupStepPassedShouldClearCacheAndCallFindPreviousStepsWithFalseParam.
@Test
public void testGetPreviousStepsWhenStreamLookupStepPassedShouldClearCacheAndCallFindPreviousStepsWithFalseParam() {
TransMeta transMeta = mock(TransMeta.class);
StepMeta stepMeta = new StepMeta("stream_lookup_id", "stream_lookup_name", new StreamLookupMeta());
List<StepMeta> expectedResult = new ArrayList<>();
List<StepMeta> invalidResult = new ArrayList<>();
expectedResult.add(new StepMeta("correct_mock", "correct_mock", new TextFileOutputMeta()));
invalidResult.add(new StepMeta("incorrect_mock", "incorrect_mock", new TextFileOutputMeta()));
doNothing().when(transMeta).clearPreviousStepCache();
when(transMeta.findPreviousSteps(any(StepMeta.class), eq(false))).thenReturn(expectedResult);
when(transMeta.findPreviousSteps(any(StepMeta.class), eq(true))).thenReturn(invalidResult);
when(transMeta.getPreviousSteps(any())).thenCallRealMethod();
List<StepMeta> actualResult = transMeta.getPreviousSteps(stepMeta);
verify(transMeta, times(1)).clearPreviousStepCache();
assertEquals(expectedResult, actualResult);
}
Aggregations