Package org.gradle.util

Examples of org.gradle.util.TestClosure


        taskExecuter.execute();
    }

    @Test
    public void testExecutesWhenReadyClosureBeforeExecute() {
        final TestClosure runnable = context.mock(TestClosure.class);
        Task a = createTask("a");

        taskExecuter.whenReady(toClosure(runnable));

        taskExecuter.addTasks(toList(a));
View Full Code Here


        }
    }

    @Test
    public void testNotifiesBeforeTaskClosureAsTasksAreExecuted() {
        final TestClosure runnable = context.mock(TestClosure.class);
        final Task a = createTask("a");
        final Task b = createTask("b");

        taskExecuter.beforeTask(toClosure(runnable));
View Full Code Here

        taskExecuter.execute();
    }

    @Test
    public void testNotifiesAfterTaskClosureAsTasksAreExecuted() {
        final TestClosure runnable = context.mock(TestClosure.class);
        final Task a = createTask("a");
        final Task b = createTask("b");

        taskExecuter.afterTask(toClosure(runnable));
View Full Code Here

        broadcast.getSource().event1("param");
    }

    @Test
    public void canUseClosureToReceiveNotificationsForSingleEventMethod() {
        final TestClosure testClosure = context.mock(TestClosure.class);
        context.checking(new Expectations() {{
            one(testClosure).call("param");
            will(returnValue("ignore me"));
        }});
View Full Code Here

        broadcast.getSource().event1("param");
    }

    @Test
    public void doesNotNotifyClosureForOtherEventMethods() {
        final TestClosure testClosure = context.mock(TestClosure.class);

        broadcast.add("event1", toClosure(testClosure));
        broadcast.getSource().event2(9, "param");
    }
View Full Code Here

        }
    }

    @Test
    public void wrapsExceptionThrownByClosure() {
        final TestClosure testClosure = context.mock(TestClosure.class);
        final RuntimeException failure = new RuntimeException();

        context.checking(new Expectations() {{
            one(testClosure).call("param");
            will(throwException(failure));
View Full Code Here

        Spec<CharSequence> spec = new Spec<CharSequence>() {
            public boolean isSatisfiedBy(CharSequence element) {
                return !element.equals("b");
            }
        };
        TestClosure testClosure = new TestClosure() {
            public Object call(Object param) {
                return !param.equals("b");   
            }
        };
View Full Code Here

        container.addObject("b");
    }

    @Test
    public void filteredCollectionExecutesClosureWhenMatchingObjectAdded() {
        final TestClosure closure = context.mock(TestClosure.class);

        context.checking(new Expectations() {{
            one(closure).call("a");
        }});
View Full Code Here

        container.addObject("a");
    }

    @Test
    public void callsClosureWhenObjectAdded() {
        final TestClosure closure = context.mock(TestClosure.class);

        context.checking(new Expectations() {{
            one(closure).call("a");
        }});
View Full Code Here

        container.allObjects(action);
    }

    @Test
    public void allObjectsCallsClosureForEachExistingObject() {
        final TestClosure closure = context.mock(TestClosure.class);

        context.checking(new Expectations() {{
            one(closure).call("a");
        }});
View Full Code Here

TOP

Related Classes of org.gradle.util.TestClosure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.