Ejemplo n.º 1
0
  @Test
  public void test_build_withName() {

    FieldBuilderImpl fieldBuilder = new FieldBuilderImpl(FLists.create(1, 2, 3));

    fieldBuilder.withName("ids");

    assertEquals("ids", fieldBuilder.getName());
    assertNull(fieldBuilder.getEntityClass());

    fieldBuilder.withName("");

    assertEquals("", fieldBuilder.getName());
    assertNull(fieldBuilder.getEntityClass());

    fieldBuilder.withName(null);

    assertNull(fieldBuilder.getName());
    assertNull(fieldBuilder.getEntityClass());

    fieldBuilder = new FieldBuilderImpl(new int[] {1, 3, 5});
    fieldBuilder.withNameAndType("data", ExampleEntity.class);

    assertEquals("data", fieldBuilder.getName());
    assertEquals(ExampleEntity.class, fieldBuilder.getEntityClass());
  }
Ejemplo n.º 2
0
  @Test
  public void test_has_entity_type() {
    FieldBuilderImpl fieldBuilder = new FieldBuilderImpl(FLists.create(1, 2, 3));

    assertFalse(fieldBuilder.hasEntityType());

    fieldBuilder.withNameAndType("name", DetailedUserEntity.class);
    assertTrue(fieldBuilder.hasEntityType());

    fieldBuilder = new FieldBuilderImpl(new HashMap());

    assertFalse(fieldBuilder.hasEntityType());

    fieldBuilder.withNameAndType("name", DetailedUserEntity.class);
    assertFalse(fieldBuilder.hasEntityType());
  }