Package org.internna.iwebmvc.model

Examples of org.internna.iwebmvc.model.Address


    @Autowired private AddressParser addressParser;
    @Autowired private DAO baseDao;

    @Before
    public void init() throws Exception {
        Address address = new Address();
        address.setCity("xx");
        address.setNumber("1");
        address.setStreet("whatever");
        address.setPostalCode("23423");
        address.setType(baseDao.first(AddressType.class));
        address.setProvince(baseDao.first(Province.class));
        baseDao.create(address);
    }
View Full Code Here


    }

    @Test
    public void testParse() {
        assertNull(addressParser.parse(null));
        Address address = new Address();
        address.setProvince(new Province());
        address.getProvince().setId(baseDao.first(Province.class).getId());
        address.setType(new AddressType());
        address.getType().setId(baseDao.first(AddressType.class).getId());
        address = addressParser.parse(address);
        assertNotNull(address.getProvince().getCountry());
        assertNotNull(address.getType().getType());
        address = new Address();
        address.setId(baseDao.first(Address.class).getId());
        address.setPostalCode("00001");
        address = addressParser.parse(address);
        assertEquals(address.getPostalCode(), "00001");
        assertNull(address.getProvince());
        address = new Address();
        address.setId(baseDao.first(Address.class).getId());
        address.setPostalCode("00001");
        address.setProvince(baseDao.find(Province.class, 0, 2).get(1));
        address = addressParser.parse(address);
        assertFalse(address.getProvince().getId().equals(baseDao.first(Province.class).getId()));
    }
View Full Code Here

        super(Address.class, dao);
    }

    @Override
    public Address parse(Address address) {
        Address parsed = address;
        if (address != null) {
            if (address.getId() != null) {
                parsed = getDao().find(Address.class, address.getId());
                BeanUtils.copyProperties(address, parsed, new String[] {"id"});
            }
View Full Code Here

TOP

Related Classes of org.internna.iwebmvc.model.Address

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.