Examples of withContents()


Examples of com.rescripter.script.RunScript.withContents()

public class FindIntegrationTest extends BaseRescripterIntegrationTest {
  @Test public void
  finds_types_by_name() throws IOException, CoreException {
    RunScript runScript = new RunScript(getWindow());
    runScript.withContents("var person = Find.typeByName('Person');\n", null, "inline script");
    IType type = runScript.getProperty(IType.class, "person");
    assertThat(type, is(notNullValue()));
    assertThat(type, is(getJavaProject().findType("com.example.Person")));
  }
 
View Full Code Here

Examples of com.rescripter.script.RunScript.withContents()

  }
 
  @Test(expected=Exception.class) public void
  fails_to_find_missing_type_by_name() throws IOException, CoreException {
    RunScript runScript = new RunScript(getWindow());
    runScript.withContents("var person = Find.typeByName('NotAPerson');\n", null, "inline script");
  }

  @Test public void
  finds_method_by_name() throws IOException, CoreException {
    RunScript runScript = new RunScript(getWindow());
View Full Code Here

Examples of com.rescripter.script.RunScript.withContents()

  }

  @Test public void
  finds_method_by_name() throws IOException, CoreException {
    RunScript runScript = new RunScript(getWindow());
    runScript.withContents(
        "var person = Find.typeByName('Person');\n" +
        "var getName = Find.methodByName(person, 'getName');\n", null, "inline script");
    assertThat(runScript.getProperty(IMethod.class, "getName"), is(notNullValue()));
  }
View Full Code Here

Examples of com.rescripter.script.RunScript.withContents()

  }

  @Test(expected=Exception.class) public void
  fails_to_find_missing_method_by_name() throws IOException, CoreException {
    RunScript runScript = new RunScript(getWindow());
    runScript.withContents(
        "var person = Find.typeByName('Person');\n" +
        "var getName = Find.methodByName(person, 'noSuchGetName');\n", null, "inline script");
  }
}
View Full Code Here

Examples of com.rescripter.script.RunScript.withContents()

  }
 
  @Test public void
  runs_basic_script() throws IOException, CoreException {
    RunScript runScript = new RunScript(getWindow());
    runScript.withContents("var response = 42;\n", null, "inline script");
    assertThat(runScript.getIntegerProperty("response"), is(42));
  }
 
}
View Full Code Here

Examples of com.rescripter.script.RunScript.withContents()

public class ASTIntegrationTest extends BaseRescripterIntegrationTest {
 
  @Test public void
  parses_compilation_unit() throws IOException, CoreException {
    RunScript runScript = new RunScript(getWindow());
    runScript.withContents(
        "var person = Find.typeByName('Person');\n" +
        "var ast = AST.parseCompilationUnit(person.getCompilationUnit());\n", null, "inline script");
   
    ASTNode ast = runScript.getProperty(ASTNode.class, "ast");
   
View Full Code Here

Examples of com.rescripter.script.RunScript.withContents()

    RunScript runScript = new RunScript(getWindow());
    String methodCallText = "person.setName(\"Bob\")";
    IType personType = getJavaProject().findType("com.example.Person");
    String personSource = personType.getCompilationUnit().getSource();
    int offsetOfCall = personSource.indexOf(methodCallText);
    runScript.withContents(
        "var person = Find.typeByName('Person');\n" +
        "var ast = AST.parseCompilationUnit(person.getCompilationUnit());\n" +
        "var node = AST.findCoveredNode(ast, " + offsetOfCall + ", " + methodCallText.length() + ");\n"
        , null, "inline script");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.