Package org.objectquery.generic.domain

Examples of org.objectquery.generic.domain.PersonDTO


public class TestGenericInternalQueryBuilder {

  @Test
  public void testSimpleSetter() throws Exception {
    PersonDTO dto = new PersonDTO();
    GenericInternalQueryBuilder.setMappingValue(dto, new PathItem(String.class, null, "name"), "the value");
    assertEquals(dto.getName(), "the value");
  }
View Full Code Here


    assertEquals(dto.getName(), "the value");
  }

  @Test(expected = Exception.class)
  public void testFailSimpleSetter() throws Exception {
    PersonDTO dto = new PersonDTO();
    GenericInternalQueryBuilder.setMappingValue(dto, new PathItem(String.class, null, "not-name"), "the value");
    assertEquals(dto.getName(), "the value");
  }
View Full Code Here

    assertEquals(dto.getName(), "the value");
  }

  @Test
  public void testSimpleGetValue() throws Exception {
    PersonDTO dto = new PersonDTO();
    dto.setName("the value");
    String name = (String) GenericInternalQueryBuilder.getValue(dto, new PathItem(String.class, null, "name"));
    assertEquals(name, "the value");
  }
View Full Code Here

    assertEquals(name, "the value");
  }

  @Test(expected = NoSuchMethodException.class)
  public void testFailSimpleGetValue() throws Exception {
    PersonDTO dto = new PersonDTO();
    GenericInternalQueryBuilder.getValue(dto, new PathItem(String.class, null, "none"));
  }
View Full Code Here

    GenericInternalQueryBuilder.getValue(dto, new PathItem(String.class, null, "none"));
  }

  @Test
  public void testGetParent() throws Exception {
    PersonDTO dto = new PersonDTO();
    Object parent = GenericInternalQueryBuilder.getParentObject(dto, new PathItem(AddressDTO.class, new PathItem(PersonDTO.class, null, ""), "addressDTO"));
    assertTrue(parent instanceof AddressDTO);
  }
View Full Code Here

    assertTrue(parent instanceof AddressDTO);
  }

  @Test(expected = NoSuchMethodException.class)
  public void testFailGetParent() throws Exception {
    PersonDTO dto = new PersonDTO();
    Object parent = GenericInternalQueryBuilder.getParentObject(dto, new PathItem(AddressDTO.class, new PathItem(PersonDTO.class, null, ""), "none"));
    assertTrue(parent instanceof AddressDTO);
  }
View Full Code Here

    Map<String, Object> values = new HashMap<>();
    values.put("addressDTO_street", "hello");
    List<Projection> projections = new ArrayList<>();
    projections.add(new Projection(new PathItem(null, null, null), new PathItem(String.class, new PathItem(AddressDTO.class, new PathItem(PersonDTO.class,
        null, ""), "addressDTO"), "street"), null));
    PersonDTO restult = GenericInternalQueryBuilder.setMapping(PersonDTO.class, projections, values);
    assertNotNull(restult);
    assertNotNull(restult.getAddressDTO());
    assertEquals(restult.getAddressDTO().getStreet(), "hello");
  }
View Full Code Here

TOP

Related Classes of org.objectquery.generic.domain.PersonDTO

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.