Package org.jmock

Examples of org.jmock.Sequence


    private FileCopyDetails expectActionExecutedWhenFileVisited() {
        final Collector<FileCopyDetails> collectDetails = collector();
        final Action<FileCopyDetails> action = context.mock(Action.class, "action1");

        context.checking(new Expectations(){{
            Sequence seq = context.sequence("seq");
            one(delegate).visitSpec(spec);
            inSequence(seq);

            allowing(spec).getAllCopyActions();
            will(returnValue(toList(action)));
View Full Code Here


        final MockFile dirFile1 = dir1.addFile("dirFile1");
        final MockFile dirFile2 = dir1.addFile("dirFile2");
        final MockFile rootFile2 = root.addFile("rootFile2");
        root.setExpectations();

        final Sequence visiting = context.sequence("visiting");
        context.checking(new Expectations() {{
            one(visitor).visitFile(with(file(rootFile1))); inSequence(visiting);
            one(visitor).visitFile(with(file(rootFile2))); inSequence(visiting);
            one(visitor).visitDir(with(file(dir1))); inSequence(visiting);
            one(visitor).visitFile(with(file(dirFile1))); inSequence(visiting);
View Full Code Here

        final MockFile dirFile1 = dir1.addFile("dirFile1");
        final MockFile dirFile2 = dir1.addFile("dirFile2");
        final MockFile rootFile2 = root.addFile("rootFile2");
        root.setExpectations();

        final Sequence visiting = context.sequence("visiting");
        context.checking(new Expectations() {{
            one(visitor).visitFile(with(file(rootFile1))); inSequence(visiting);
            one(visitor).visitFile(with(file(rootFile2))); inSequence(visiting);
            one(visitor).visitFile(with(file(dirFile1))); inSequence(visiting);
            one(visitor).visitFile(with(file(dirFile2))); inSequence(visiting);
View Full Code Here

            one(visitor).visitFile(with(file(rootFile1))); will(stopVisiting());
        }});

        walker.start(root.getMock());

        final Sequence visiting = context.sequence("visiting");
        context.checking(new Expectations() {{
            one(visitor).visitFile(with(file(rootFile1))); inSequence(visiting);
            one(visitor).visitFile(with(file(rootFile2))); inSequence(visiting);
            one(visitor).visitDir(with(file(dir1))); inSequence(visiting);
            one(visitor).visitFile(with(file(dirFile1))); will(stopVisiting()); inSequence(visiting);
View Full Code Here

    @Test
    public void sendsAMethodMetaInfoMessageWhenAMethodIsFirstReferenced() throws Exception {
        final Method method = String.class.getMethod("charAt", Integer.TYPE);

        context.checking(new Expectations() {{
            Sequence sequence = context.sequence("seq");

            one(target).dispatch(new MethodMetaInfo(0, method));
            inSequence(sequence);

            one(target).dispatch(new RemoteMethodInvocation(0, new Object[]{17}));
View Full Code Here

    }

    @Test
    public void workerProcessCanSendMessagesToThisProcess() throws Throwable {
        context.checking(new Expectations() {{
            Sequence sequence = context.sequence("sequence");
            one(listenerMock).send("message 1", 1);
            inSequence(sequence);
            one(listenerMock).send("message 2", 2);
            inSequence(sequence);
        }});
View Full Code Here

    }

    @Test
    public void multipleWorkerProcessesCanSendMessagesToThisProcess() throws Throwable {
        context.checking(new Expectations() {{
            Sequence process1 = context.sequence("sequence1");
            one(listenerMock).send("message 1", 1);
            inSequence(process1);
            one(listenerMock).send("message 2", 2);
            inSequence(process1);
            Sequence process2 = context.sequence("sequence2");
            one(listenerMock).send("other 1", 1);
            inSequence(process2);
            one(listenerMock).send("other 2", 2);
            inSequence(process2);
        }});
View Full Code Here

    public void passesEachProjectPropertyToRenderer() throws IOException {
        context.checking(new Expectations() {{
            one(project).getProperties();
            will(returnValue(GUtil.map("b", "value2", "a", "value1")));

            Sequence sequence = context.sequence("seq");

            one(renderer).addProperty("a", "value1");
            inSequence(sequence);

            one(renderer).addProperty("b", "value2");
View Full Code Here

    public void doesNotShowContentsOfThePropertiesProperty() throws IOException {
        context.checking(new Expectations() {{
            one(project).getProperties();
            will(returnValue(GUtil.map("prop", "value", "properties", "prop")));

            Sequence sequence = context.sequence("seq");

            one(renderer).addProperty("prop", "value");
            inSequence(sequence);
            one(renderer).addProperty("properties", "{...}");
            inSequence(sequence);
View Full Code Here

    }
   
    @Test
    public void executesTaskWhenOutputsAreNotUpToDate() {
        context.checking(new Expectations() {{
            Sequence sequence = context.sequence("seq");

            one(repository).getStateFor(task);
            will(returnValue(taskArtifactState));
            inSequence(sequence);
View Full Code Here

TOP

Related Classes of org.jmock.Sequence

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.