List<Script> scripts = new ArrayList<Script>();
long scriptNo = 0L;
ScriptList result = mock(ScriptList.class);
for (String scriptName: scriptNames){
scriptNo++;
Script script = mock(Script.class);
when(script.getDBVersion()).thenReturn(dbVersion);
when(script.getFileName()).thenReturn(scriptName);
when(script.getPatch()).thenReturn(scriptNo);
when(script.condtionStatus()).thenReturn("Test");
when(script.execute(any(UserInteractionStrategy.class))).thenThrow(new RuntimeException("TBI"));
when(script.compareTo(any(Script.class))).thenThrow(new RuntimeException("TBI"));
scripts.add(script);
when(result.get((int)scriptNo)).thenReturn(script);
}
when(result.iterator()).thenReturn(scripts.iterator());
when(result.size()).thenReturn(scripts.size());