Package com.astech.domain

Examples of com.astech.domain.Account


    /**
     * Returns a new Account instance filled with random values.
     */
    public Account getAccount() {
        Account account = new Account();

        // simple attributes follows
        account.setLogin("a");
        account.setPassword("a");
        account.setEmail("dummy@dummy.com");
        // mandatory relation
        Role roleRef = roleGenerator.getRole();
        roleRepository.save(roleRef);
        account.setRoleRef(roleRef);
        return account;
    }
View Full Code Here


    @Autowired
    private AccountGenerator accountGenerator;

    @Test
    public void identityShouldBePreserved() {
        Account account = accountGenerator.getAccount();

        // add it to a Set before saving (force equals/hashcode)
        Sets.newHashSet(account);

        accountRepository.save(account);
        entityManager.flush();

        // reload it from cache and check equality
        Integer id = account.getIdAccount();
        assertThat(account).isEqualTo(accountRepository.findOne(id));

        // clear cache to force reload from db
        entityManager.clear();

        // pk are equals...
        assertThat(account.getId()).isEqualTo(accountRepository.findOne(id).getId());

        // but since you do not use a business key, equality is lost.
        assertThat(account).isNotEqualTo(accountRepository.findOne(id));
    }
View Full Code Here

    }

    @Override
    public Account parse(String text, Locale locale) throws ParseException {
        if (isBlank(text)) {
            return new Account();
        }
        Account account = accountRepository.findOne(new Integer(text));
        return account != null ? account : new Account();
    }
View Full Code Here

TOP

Related Classes of com.astech.domain.Account

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.