コード例 #1
0
  // test is for fourth calloutMapping in Testdata (Role)
  public void testSubTreeMatch() {
    CalloutMappingDeclaration calloutDecl =
        (CalloutMappingDeclaration) _role.bodyDeclarations().get(7);
    List parameterMappings = calloutDecl.getParameterMappings();
    ParameterMapping testObj = (ParameterMapping) parameterMappings.get(2);

    boolean actual = testObj.subtreeMatch(new ASTMatcher(), testObj);

    assertTrue("Both nodes are equal, even the same.", actual);
  }
コード例 #2
0
  // test is for first calloutMapping in Testdata (Role)
  public void testHasResultFlag_false() {
    CalloutMappingDeclaration calloutDecl =
        (CalloutMappingDeclaration) _role.bodyDeclarations().get(4);
    List parameterMappings = calloutDecl.getParameterMappings();

    ParameterMapping testObj = (ParameterMapping) parameterMappings.get(0);
    boolean actual = testObj.hasResultFlag();

    assertFalse("Mapping is a not a result mapping", actual);
  }
コード例 #3
0
  // test is for first calloutMapping in Testdata (Role)
  public void testGetDirection() {
    CalloutMappingDeclaration calloutDecl =
        (CalloutMappingDeclaration) _role.bodyDeclarations().get(4);
    List parameterMappings = calloutDecl.getParameterMappings();

    ParameterMapping testObj = (ParameterMapping) parameterMappings.get(0);
    String actual = testObj.getDirection();
    String expected = "->";

    assertEquals("Wrong direction", expected, actual);
  }
コード例 #4
0
  // test is for fourth calloutMapping in Testdata (Role)
  public void testHasResultFlag_true2() {
    CalloutMappingDeclaration calloutDecl =
        (CalloutMappingDeclaration) _role.bodyDeclarations().get(7);
    List parameterMappings = calloutDecl.getParameterMappings();

    // test the third parameterMapping of this CalloutMappingDeclaration
    ParameterMapping testObj = (ParameterMapping) parameterMappings.get(2);
    boolean actual = testObj.hasResultFlag();

    assertTrue("Mapping is a result mapping, but was not detected", actual);
  }
コード例 #5
0
  // test is for first calloutMapping in Testdata (Role)
  public void testGetIdentifier() {
    CalloutMappingDeclaration calloutDecl =
        (CalloutMappingDeclaration) _role.bodyDeclarations().get(4);
    List parameterMappings = calloutDecl.getParameterMappings();

    ParameterMapping testObj = (ParameterMapping) parameterMappings.get(0);
    String actual = testObj.getIdentifier().getIdentifier();
    String expected = "val";

    assertEquals("Identifier is wrong", expected, actual);
  }
コード例 #6
0
  public void testCopySubtree() {
    CalloutMappingDeclaration calloutDecl =
        (CalloutMappingDeclaration) _role.bodyDeclarations().get(7);
    List parameterMappings = calloutDecl.getParameterMappings();
    ParameterMapping testObj = (ParameterMapping) parameterMappings.get(2);

    ParameterMapping clonedTestObject =
        (ParameterMapping) ASTNode.copySubtree(AST.newAST(AST.JLS4), testObj);
    boolean actual = testObj.subtreeMatch(new ASTMatcher(), clonedTestObject);

    assertTrue("Copy of subtree not correct", actual);
  }
コード例 #7
0
  // test is for fourth calloutMapping in Testdata (Role)
  public void testGetExpression_InstanceType3() {
    CalloutMappingDeclaration calloutDecl =
        (CalloutMappingDeclaration) _role.bodyDeclarations().get(7);
    List parameterMappings = calloutDecl.getParameterMappings();

    ParameterMapping testObj = (ParameterMapping) parameterMappings.get(0);
    Expression actual = (Expression) testObj.getExpression();

    assertTrue(
        "Wrong Type of given expression, type is  " + actual.getClass(),
        actual instanceof SimpleName);
  }