Package test.command

Examples of test.command.TestInvocationContext


    assertEquals(Arrays.asList("arg_value"), ctx.getProducedItems());
  }

  public void testArgumentAccessInClosure() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("{ arg -> context.provide(arg) };");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.execute2(clazz, "arg_value");
    assertEquals(Arrays.asList("arg_value"), ctx.getProducedItems());
  }
View Full Code Here


      "return context;\n" +
      "}\n" +
      "}\n");

    // Execute directly
    TestInvocationContext context = new TestInvocationContext();
    context.execute(clazz);
    assertEquals(1, context.getProducedItems().size());
    assertInstance(InvocationContext.class, context.getProducedItems().get(0));
  }
View Full Code Here

    assertInstance(InvocationContext.class, context.getProducedItems().get(0));
  }

  public void testResolveContextInScript() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("return context");
    TestInvocationContext context = new TestInvocationContext();
    context.execute2(clazz);
    assertEquals(1, context.getProducedItems().size());
    assertInstance(InvocationContext.class, context.getProducedItems().get(0));
  }
View Full Code Here

    assertInstance(InvocationContext.class, context.getProducedItems().get(0));
  }

  public void testScriptUseReturnValue() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("return 'def'");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.execute2(clazz);
    assertEquals(Arrays.asList("def"), ctx.getProducedItems());
  }
View Full Code Here

    assertEquals(Arrays.asList("def"), ctx.getProducedItems());
  }

  public void testScriptDiscardImplicitReturnValue() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("def a = 'def'");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.execute2(clazz);
    assertEquals(0, ctx.getProducedItems().size());
  }
View Full Code Here

    assertEquals(0, ctx.getProducedItems().size());
  }

  public void testScriptReturnExplicitReturnValue() throws Exception {
    Class<? extends GroovyScriptCommand>  clazz = loader.parseClass("return 'def'");
    TestInvocationContext ctx = new TestInvocationContext();
    ctx.execute2(clazz);
    assertEquals(Arrays.asList("def"), ctx.getProducedItems());
  }
View Full Code Here

TOP

Related Classes of test.command.TestInvocationContext

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.