@Test
  public void testProduceReturnsOutputWithGenerationGap2() {
    // Given:
    String pojoClassname = testdata.generationgap.Order.class.getName();

    TypeElement pojoTypeElement = elements.getTypeElement(pojoClassname);

    // When:
    Output output = underTest.produce(new Input(pojoTypeElement));
    BuilderM builder = output.getBuilder();
    ManualBuilderM manualBuilder = output.getManualBuilder();

    // Then:
    assertEquals("type", TypeM.get("testdata.generationgap.OrderBuilder"), manualBuilder.getType());
    assertEquals(
        "type.generic",
        "OrderBuilder<T extends Object>",
        manualBuilder.getType().getGenericTypeSimpleNameWithBounds());
    assertEquals(
        "superType",
        TypeM.get("testdata.generationgap.AbstractOrderBuilder"),
        manualBuilder.getSuperType());
    assertEquals(
        "type", TypeM.get("testdata.generationgap.AbstractOrderBuilder"), builder.getType());
    assertEquals(
        "type.generic",
        "AbstractOrderBuilder<T extends Object>",
        builder.getType().getGenericTypeSimpleNameWithBounds());
    assertEquals("superType", TypeM.get(Object.class.getName()), builder.getSuperType());
  }
Пример #2
0
  @Test
  public void testProduceReturnsBuilderWithCorrectSuperType() {
    // Given:
    String pojoClassname = Contact.class.getName();
    TypeElement pojoType = elements.getTypeElement(pojoClassname);

    // When:
    Output output = underTest.produce(new Input(pojoType));
    BuilderM builder = output.getBuilder();

    // Then:
    assertEquals("type", TypeM.get(Object.class.getName()), builder.getSuperType());
  }
  @Test
  public void testProduceReturnsOutputWithGenerationGap1() {
    // Given:
    String pojoClassname = testdata.generationgap.Contact.class.getName();

    TypeElement pojoTypeElement = elements.getTypeElement(pojoClassname);

    // When:
    Output output = underTest.produce(new Input(pojoTypeElement));
    BuilderM builder = output.getBuilder();
    ManualBuilderM manualBuilder = output.getManualBuilder();

    // Then:
    assertEquals(
        "type", TypeM.get("testdata.generationgap.ContactBuilder"), manualBuilder.getType());
    assertEquals(
        "superType",
        TypeM.get("testdata.generationgap.AbstractContactBuilder"),
        manualBuilder.getSuperType());
    assertEquals(
        "type", TypeM.get("testdata.generationgap.AbstractContactBuilder"), builder.getType());
    assertEquals("superType", TypeM.get(Object.class.getName()), builder.getSuperType());
  }