Package fitnesse.slim.instructions

Examples of fitnesse.slim.instructions.CallInstruction


    private List<SlimAssertion> setVariables(int row) {
      List<SlimAssertion> assertions = new ArrayList<SlimAssertion>();
      for (String var : varStore.getLeftToRightAndResetColumnNumberIterator()) {
        int col = varStore.getColumnNumber(var);
        String valueToSet = table.getCellContents(col, row);
        Instruction setInstruction = new CallInstruction(makeInstructionTag(), getTableName(), Disgracer.disgraceMethodName("set " + var), new Object[] {valueToSet});
        assertions.add(makeAssertion(setInstruction,
                new VoidReturnExpectation(col, row)));
      }
      return assertions;
    }
View Full Code Here


    Map<String, Object> result = slimClient.invokeAndGetResponse(statements);
    assertEquals("1", result.get("id"));
  }

  private void addEchoInt(String id, String number) {
    statements.add(new CallInstruction(id, "testSlim", "echoInt", new Object[] { number }));
  }
View Full Code Here

  }

  @Test
  public void callWithLineBreakInStringArgument() throws Exception {
    addImportAndMake();
    statements.add(new CallInstruction("id", "testSlim", "echoString", new Object[] { "hello\nworld\n" }));
    Map<String, Object> result = slimClient.invokeAndGetResponse(statements);
    assertEquals("hello\nworld\n", result.get("id"));
  }
View Full Code Here

  }

  @Test
  public void callWithMultiByteChar() throws Exception {
    addImportAndMake();
    statements.add(new CallInstruction("id", "testSlim", "echoString", new Object[] { "K\u00f6ln" }));
    Map<String, Object> result = slimClient.invokeAndGetResponse(statements);
    assertEquals("K\u00f6ln", result.get("id"));
  }
View Full Code Here

  }

  @Test
  public void callFunctionThatDoesntExist() throws Exception {
    addImportAndMake();
    statements.add(new CallInstruction("id", "testSlim", "noSuchFunction"));
    Map<String, Object> results = slimClient.invokeAndGetResponse(statements);
    assertContainsException("message:<<NO_METHOD_IN_CLASS", "id", results);
  }
View Full Code Here

  }

  @Test
  public void callFunctionThatReturnsHugeResult() throws Exception {
    addImportAndMake();
    statements.add(new CallInstruction("id", "testSlim", "returnHugeString"));
    slimClient.invokeAndGetResponse(statements);
    // should not crash
  }
View Full Code Here

  @Test
  public void callFunctionWithHugeParameter() throws Exception {
    addImportAndMake();
    String hugeString = StringUtils.repeat("x", 999999 + 10);
    statements.add(new CallInstruction("id", "testSlim", "echoString", new Object[] {hugeString}));
    Map<String, Object> result = slimClient.invokeAndGetResponse(statements);
    assertEquals(hugeString, result.get("id"));
  }
View Full Code Here

  }

  @Test
  public void useInstanceThatDoesntExist() throws Exception {
    addImportAndMake();
    statements.add(new CallInstruction("id", "noInstance", "f"));
    Map<String, Object> results = slimClient.invokeAndGetResponse(statements);
    assertContainsException("message:<<NO_INSTANCE", "id", results);
  }
View Full Code Here

  }

  @Test
  public void notStopTestExceptionThrown() throws Exception {
    addImportAndMake();
    statements.add(new CallInstruction("id", "testSlim", "throwNormal"));
    statements.add(new CallInstruction("id2", "testSlim", "throwNormal"));
    Map<String, Object> results = slimClient.invokeAndGetResponse(statements);
    assertContainsException("__EXCEPTION__:" + expectedExceptionMessage(), "id", results);
    assertContainsException("__EXCEPTION__:" + expectedExceptionMessage(), "id2", results);
  }
View Full Code Here

  }

  @Test
  public void stopTestExceptionThrown() throws Exception {
    addImportAndMake();
    statements.add(new CallInstruction("id", "testSlim", "throwStopping"));
    statements.add(new CallInstruction("id2", "testSlim", "throwNormal"));
    Map<String, Object> results = slimClient.invokeAndGetResponse(statements);
    assertContainsException("__EXCEPTION__:" + expectedStopTestExceptionMessage(), "id", results);
    assertNull(results.get("id2"));
  }
View Full Code Here

TOP

Related Classes of fitnesse.slim.instructions.CallInstruction

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.