Package net.karneim.pojobuilder.analysis

Examples of net.karneim.pojobuilder.analysis.Output


    String pojoClassname = SubclassPojo2.class.getCanonicalName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);
    Input input = inputFactory.getInput(pojoType);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    TypeM builderType = output.getBuilderModel().getType();
    assertThat(builderType).isNotNull();
    assertThat(builderType.getName())
        .isEqualTo("net.karneim.pojobuilder.analysis.with.superclass.SubclassPojo2Builder");
    assertThat(output.getBuilderModel().getProperties()).hasSize(3);
    PropertyM visibleMemberProperty = output.getBuilderModel().getProperties().get(new Key("visibleMember", "int"));
    assertThat(visibleMemberProperty).isNotNull();
    assertThat(visibleMemberProperty.getFieldAccess()).isNotNull();
    assertThat(visibleMemberProperty.getFieldAccess().getModifier()).contains(Modifier.PUBLIC);
   
    PropertyM protectedMemberProperty = output.getBuilderModel().getProperties().get(new Key("protectedMember", "float"));
    assertThat(protectedMemberProperty).isNotNull();
    assertThat(protectedMemberProperty.getFieldAccess()).isNotNull();
    assertThat(protectedMemberProperty.getFieldAccess().getModifier()).contains(Modifier.PROTECTED);
   
    PropertyM nameMemberProperty = output.getBuilderModel().getProperties().get(new Key("name", "java.lang.String"));
    assertThat(nameMemberProperty).isNotNull();
    assertThat(nameMemberProperty.getFieldAccess()).isNull();
    assertThat(nameMemberProperty.getGetterMethod().getModifier()).contains(Modifier.PROTECTED);
    assertThat(nameMemberProperty.getSetterMethod().getModifier()).contains(Modifier.PROTECTED);
   
    assertThat(output.getBuilderModel().getProperties().get(new Key("hiddenMember", "float"))).isNull();
   

  }
View Full Code Here


    String pojoClassname = SubclassPojo3.class.getCanonicalName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);
    Input input = inputFactory.getInput(pojoType);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    TypeM builderType = output.getBuilderModel().getType();
    assertThat(builderType).isNotNull();
    assertThat(builderType.getName())
        .isEqualTo("net.karneim.pojobuilder.analysis.with.superclass.SubclassPojo3Builder");
    assertThat(output.getBuilderModel().getProperties()).hasSize(1);
    PropertyM visibleMemberProperty = output.getBuilderModel().getProperties().get(new Key("visibleMember", "int"));
    assertThat(visibleMemberProperty).isNotNull();
    assertThat(visibleMemberProperty.getFieldAccess()).isNotNull();
    assertThat(visibleMemberProperty.getFieldAccess().getModifier()).contains(Modifier.PUBLIC);
    assertThat(output.getBuilderModel().getProperties().get(new Key("hiddenMember", "float"))).isNull();;

  }
View Full Code Here

    String pojoClassname = Pojo.class.getCanonicalName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);
    Input input = inputFactory.getInput(pojoType);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    assertThat(output.getBuilderModel().getType().getName()).isEqualTo(
        "net.karneim.pojobuilder.analysis.with.name.FluentPojoBuilder");

  }
View Full Code Here

    String pojoClassname = PojoA.class.getCanonicalName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);
    Input input = inputFactory.getInput(pojoType);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    assertThat(output.getBuilderModel().getType().getName()).isEqualTo("builder.FluentPojoABuilderA");
  }
View Full Code Here

    String pojoClassname = PojoAB.class.getCanonicalName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);
    Input input = inputFactory.getInput(pojoType);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    assertThat(output.getBuilderModel().getType().getName()).isEqualTo("builder.FluentPojoABBuilderB");
    assertThat(output.getBuilderModel().getCopyMethod()).isNotNull();
  }
View Full Code Here

    String pojoClassname = PojoC.class.getCanonicalName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);
    Input input = inputFactory.getInput(pojoType);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    assertThat(output.getBuilderModel().getType().getName()).isEqualTo("builder.FluentPojoCBuilderB");
  }
View Full Code Here

    List<ExecutableElement> methods = ElementFilter.methodsIn(elements.getAllMembers(factoryType));
    ExecutableElement methodEl = getFirstMethodByName("createPojoF", methods);
    Input input = inputFactory.getInput(methodEl);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    assertThat(output.getBuilderModel().getType().getName()).isEqualTo(
        "net.karneim.pojobuilder.analysis.with.customannotation.FluentPojoFBuilderF");
  }
View Full Code Here

    String pojoClassname = Pojo.class.getCanonicalName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);
    Input input = inputFactory.getInput(pojoType);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    assertThat(output.getBuilderModel().getType().getName()).isEqualTo("builder.PojoBuilder");

  }
View Full Code Here

    String pojoClassname = Pojo.class.getCanonicalName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);
    Input input = inputFactory.getInput(pojoType);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    assertThat(output.getBuilderModel().getType().getName()).isEqualTo(
        "net.karneim.pojobuilder.analysis.with.baseclass.PojoBuilder");
    assertThat(output.getBuilderModel().getBaseType().getName()).isEqualTo(
        "net.karneim.pojobuilder.analysis.with.baseclass.BuilderBaseclass");
  }
View Full Code Here

    String pojoClassname = ContainerPojo.class.getCanonicalName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);
    Input input = inputFactory.getInput(pojoType);

    // When:
    Output output = underTest.analyze(input);

    // Then:
    assertThat(output).isNotNull();
    assertThat(output.getBuilderModel().getPojoType().getName()).isEqualTo(pojoClassname);
    TypeM builderType = output.getBuilderModel().getType();
    assertThat(builderType).isNotNull();
    assertThat(builderType.getName()).isEqualTo("net.karneim.pojobuilder.analysis.with.generics.ContainerPojoBuilder");
    assertThat(builderType.getGenericType())
        .isEqualTo(
            "net.karneim.pojobuilder.analysis.with.generics.ContainerPojoBuilder<T extends net.karneim.pojobuilder.analysis.with.generics.ItemPojo & java.io.Serializable>");
    assertThat(output.getBuilderModel().getProperties()).hasSize(1);
    PropertyM nameProperty = output.getBuilderModel().getProperties().get(new Key("element", "T"));
    assertThat(nameProperty).isNotNull();
    assertThat(nameProperty.getFieldAccess()).isNotNull();
    assertThat(nameProperty.getFieldAccess().getModifier()).contains(Modifier.PUBLIC);
  }
View Full Code Here

TOP

Related Classes of net.karneim.pojobuilder.analysis.Output

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.