Example #1
0
  private void verifyAddress(AddressIn address, AddressOut address1) {
    if (address == null) {
      Assert.assertNull(address1);
    } else {
      Assert.assertEquals(address.getStreet(), address1.getStreet());
      Assert.assertEquals(address.getNumber(), address1.getNumber());
      Assert.assertEquals(address.getExtras(), address1.getExtras());

      verifyCity(address.getCity(), address1.getCity());
    }
  }
Example #2
0
  @Test
  public void beanMapper_should_map_properties_resolving_generics() throws Exception {

    SpecificMapper mapper = Selma.getMapper(SpecificMapper.class);

    AddressIn addressIn = new AddressIn();
    addressIn.setPrincipal(true);
    addressIn.setNumber(55);
    addressIn.setStreet("rue de la truanderie");
    addressIn.setCity(new CityIn());
    addressIn.getCity().setCapital(true);
    addressIn.getCity().setName("Paris");
    addressIn.getCity().setPopulation(3 * 1000 * 1000);

    AddressOut res = mapper.asEntity(addressIn);

    Assert.assertNotNull(res);
    verifyAddress(addressIn, res);
  }