Examples of BlockStmt


Examples of japa.parser.ast.stmt.BlockStmt

    @Then("block statement in method $methodPosition in class $classPosition has $expectedCount orphan comments")
    public void thenBlockStatementInMethodInClassHasOrphanComments(int methodPosition, int classPosition, int expectedCount) {
        TypeDeclaration classUnderTest = compilationUnit.getTypes().get(classPosition - 1);
        MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition - 1,
                MethodDeclaration.class);
        BlockStmt blockStmtUnderTest = methodUnderTest.getBody();
        assertThat(blockStmtUnderTest.getOrphanComments().size(), is(expectedCount));
    }
View Full Code Here

Examples of japa.parser.ast.stmt.BlockStmt

    @Then("block statement in method $methodPosition in class $classPosition orphan comment $commentPosition is \"$expectedContent\"")
    public void thenBlockStatementInMethodInClassIs(int methodPosition, int classPosition, int commentPosition, String expectedContent) {
        TypeDeclaration classUnderTest = compilationUnit.getTypes().get(classPosition - 1);
        MethodDeclaration methodUnderTest = (MethodDeclaration) getMemberByTypeAndPosition(classUnderTest, methodPosition -1,
                MethodDeclaration.class);
        BlockStmt blockStmtUnderTest = methodUnderTest.getBody();
        Comment commentUnderTest = blockStmtUnderTest.getOrphanComments().get(commentPosition - 1);
        assertThat(commentUnderTest.getContent(), is(equalToIgnoringWhiteSpace(expectedContent)));
    }
View Full Code Here

Examples of japa.parser.ast.stmt.BlockStmt

        this.state = state;
    }

    @Given("a BlockStmt")
    public void givenABlockStatement() {
        blockStmt = new BlockStmt();
    }
View Full Code Here

Examples of japa.parser.ast.stmt.BlockStmt

    }

    @When("a BlockStmt is added to method $methodPosition in class $classPosition")
    public void whenABlockStmtIsAddedToMethodInClass(int methodPosition, int classPosition) {
        MethodDeclaration method = getMethodByPositionAndClassPosition(methodPosition, classPosition);
        method.setBody(new BlockStmt());
    }
View Full Code Here

Examples of japa.parser.ast.stmt.BlockStmt

    JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
    List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
    List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
    List<Parameter> parameters = visit(_n.getParameters(), _arg);
    List<NameExpr> throws_ = visit(_n.getThrows(), _arg);
    BlockStmt block = cloneNodes(_n.getBlock(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);

    ConstructorDeclaration r = new ConstructorDeclaration(
        _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
         _n.getModifiers(), annotations, typeParameters, _n.getName(), parameters, throws_, block
View Full Code Here

Examples of japa.parser.ast.stmt.BlockStmt

    List<AnnotationExpr> annotations = visit(_n.getAnnotations(), _arg);
    List<TypeParameter> typeParameters = visit(_n.getTypeParameters(), _arg);
    Type type_ = cloneNodes(_n.getType(), _arg);
    List<Parameter> parameters = visit(_n.getParameters(), _arg);
    List<NameExpr> throws_ = visit(_n.getThrows(), _arg);
    BlockStmt block = cloneNodes(_n.getBody(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);

    MethodDeclaration r = new MethodDeclaration(
        _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
         _n.getModifiers(), annotations, typeParameters, type_, _n.getName(), parameters, _n.getArrayCount(), throws_, block
View Full Code Here

Examples of japa.parser.ast.stmt.BlockStmt

  }

  @Override
  public Node visit(InitializerDeclaration _n, Object _arg) {
    JavadocComment javaDoc = cloneNodes(_n.getJavaDoc(), _arg);
    BlockStmt block = cloneNodes(_n.getBlock(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);

    InitializerDeclaration r = new InitializerDeclaration(
        _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
         _n.isStatic(), block
View Full Code Here

Examples of japa.parser.ast.stmt.BlockStmt

  @Override
  public Node visit(BlockStmt _n, Object _arg) {
    List<Statement> stmts = visit(_n.getStmts(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);

    BlockStmt r = new BlockStmt(
        _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
        stmts
    );
    r.setComment(comment);
    return r;
  }
View Full Code Here

Examples of japa.parser.ast.stmt.BlockStmt

  }

  @Override
  public Node visit(SynchronizedStmt _n, Object _arg) {
    Expression expr = cloneNodes(_n.getExpr(), _arg);
    BlockStmt block = cloneNodes(_n.getBlock(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);

    SynchronizedStmt r = new SynchronizedStmt(
        _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
        expr, block
View Full Code Here

Examples of japa.parser.ast.stmt.BlockStmt

  }

  @Override
  public Node visit(TryStmt _n, Object _arg) {
    List<VariableDeclarationExpr> resources = visit(_n.getResources(),_arg);
    BlockStmt tryBlock = cloneNodes(_n.getTryBlock(), _arg);
    List<CatchClause> catchs = visit(_n.getCatchs(), _arg);
    BlockStmt finallyBlock = cloneNodes(_n.getFinallyBlock(), _arg);
    Comment comment = cloneNodes(_n.getComment(), _arg);

    TryStmt r = new TryStmt(
        _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
        resources, tryBlock, catchs, finallyBlock
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.