public class InitScriptHandlerTest {
@Test
public void testExecuteScripts() {
JUnit4Mockery context = new JUnit4Mockery();
final InitScriptFinder finderMock = context.mock(InitScriptFinder.class);
final InitScriptProcessor processorMock = context.mock(InitScriptProcessor.class);
final GradleInternal gradleMock = context.mock(GradleInternal.class);
final ScriptSource source1Mock = context.mock(ScriptSource.class, "source 1");
final ScriptSource source2Mock = context.mock(ScriptSource.class, "source 2");
final List<ScriptSource> testSources = new ArrayList<ScriptSource>();
testSources.add(source1Mock);
testSources.add(source2Mock);
context.checking(new Expectations() {{
one(finderMock).findScripts(gradleMock);
will(returnValue(testSources));
one(processorMock).process(source1Mock, gradleMock);
one(processorMock).process(source2Mock, gradleMock);
}});