Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.AST


    EList<TemplateParameter> templateParameters = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());
    when(clazz.getOwnedTemplateSignature()).thenReturn(templateSignature);
    when(templateSignature.getParameters()).thenReturn(templateParameters);

    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();

    TypeDeclaration typeDeclaration = exceptionGenerator.generateClass(
        clazz, ast, cu);

    assertEquals(typeDeclaration.toString(),
View Full Code Here


        "public class CompanyException extends Exception {\n}\n");
  }

  @Test
  public void testGenerateClassUncheckedExceptionWithNoInheritance() {
    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();

    exceptionGenerator.setCheckedException(false);
    TypeDeclaration typeDeclaration = exceptionGenerator.generateClass(
        clazz, ast, cu);
View Full Code Here

    when(generalization2.getGeneral()).thenReturn(clazzGeneralization2);
    when(clazzGeneralization2.getQualifiedName()).thenReturn(
        "de::test::SuperDuperCompanyException");
    when(clazz.getGeneralizations()).thenReturn(generalizations);

    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();

    exceptionGenerator.setCheckedException(false);
    try {
      exceptionGenerator.generateClass(clazz, ast, cu);
      assertTrue(false);
View Full Code Here

    when(generalization.getGeneral()).thenReturn(clazzGeneralization);
    when(clazzGeneralization.getQualifiedName()).thenReturn(
        "de::test::SuperCompanyException");
    when(clazz.getGeneralizations()).thenReturn(generalizations);

    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();

    exceptionGenerator.setCheckedException(false);
    TypeDeclaration typeDeclaration = exceptionGenerator.generateClass(
        clazz, ast, cu);
View Full Code Here

    EList<TemplateParameter> templateParameters = mock(EList.class,
        Answers.RETURNS_DEEP_STUBS.get());
    when(clazz.getOwnedTemplateSignature()).thenReturn(templateSignature);
    when(templateSignature.getParameters()).thenReturn(templateParameters);

    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();

    exceptionGenerator.setCheckedException(false);
    TypeDeclaration typeDeclaration = exceptionGenerator.generateClass(
        clazz, ast, cu);
View Full Code Here

        "public class CompanyException extends RuntimeException {\n}\n");
  }

  @Test
  public void testGenerateSerialVersionUID() {
    AST ast = AST.newAST(AST.JLS3);
    TypeDeclaration td = ast.newTypeDeclaration();
    td.setName(ast.newSimpleName("Company"));

    exceptionGenerator.generateSerialVersionUID(clazz, ast, td);

    assertEquals(
        "class Company {\n  private static final long serialVersionUID=1L;\n}\n",
View Full Code Here

        td.toString());
  }

  @Test
  public void testGenerateConstructors() {
    AST ast = AST.newAST(AST.JLS3);
    TypeDeclaration td = ast.newTypeDeclaration();
    td.setName(ast.newSimpleName("CompanyException"));

    when(clazz.getName()).thenReturn("CompanyException");

    exceptionGenerator.generateConstructors(clazz, ast, td);
View Full Code Here

        td.toString());
  }

  @Test
  public void testGenerateConstructorWithParams() {
    AST ast = AST.newAST(AST.JLS3);
    TypeDeclaration td = ast.newTypeDeclaration();
    td.setName(ast.newSimpleName("CompanyException"));

    when(clazz.getName()).thenReturn("CompanyException");

    exceptionGenerator.generateConstructorWithParams(clazz, ast, td,
        new String[] { "String", "Throwable" }, new String[] {
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  @Test
  public void testGenerateAssociationEndUpperCardinalityMultiplesIsUnique() {
    AST ast = AST.newAST(AST.JLS3);
    ast.newCompilationUnit();
    TypeDeclaration td = ast.newTypeDeclaration();
    td.setInterface(true);
    Modifier modifier = ast
        .newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
    td.modifiers().add(modifier);
    td.setName(ast.newSimpleName("Company"));

    Property property = mock(Property.class);

    MethodDeclaration mdGetter = ast.newMethodDeclaration();
    mdGetter.setName(ast.newSimpleName("getCompanies"));

    String umlQualifiedTypeName = "test.de.Company";
    String umlTypeName = "Company";

    when(property.isOrdered()).thenReturn(false);
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  @Test
  public void testGenerateAssociationEndUpperCardinalityMultiplesDefault() {
    AST ast = AST.newAST(AST.JLS3);
    ast.newCompilationUnit();
    TypeDeclaration td = ast.newTypeDeclaration();
    td.setInterface(true);
    Modifier modifier = ast
        .newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
    td.modifiers().add(modifier);
    td.setName(ast.newSimpleName("Company"));

    Property property = mock(Property.class);

    MethodDeclaration mdGetter = ast.newMethodDeclaration();
    mdGetter.setName(ast.newSimpleName("getCompanies"));

    String umlQualifiedTypeName = "test.de.Company";
    String umlTypeName = "Company";

    when(property.isOrdered()).thenReturn(false);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.AST

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.