@SuppressWarnings("unchecked") @Test @DataSet public void testMassUpdate() { List<Integer> updateKeys = Arrays.asList(1, 2, 3); Account account = new Account(); account.setAssignuser("hai79"); account.setIndustry("aaa"); accountService.massUpdateWithSession(account, updateKeys, 1); AccountSearchCriteria criteria = new AccountSearchCriteria(); criteria.setSaccountid(new NumberSearchField(1)); List<SimpleAccount> accounts = accountService.findPagableListByCriteria( new SearchRequest<>(criteria, 0, Integer.MAX_VALUE)); assertThat(accounts.size()).isEqualTo(3); assertThat(accounts) .extracting("id", "accountname", "industry", "assignuser") .contains( tuple(1, "xyz", "aaa", "hai79"), tuple(2, "xyz1", "aaa", "hai79"), tuple(3, "xyz2", "aaa", "hai79")); }
@Test @DataSet public void testUpdateAccount() { Account account = new Account(); account.setId(1); account.setAccountname("abc"); account.setSaccountid(1); accountService.updateWithSession(account, "hai79"); accountService.findById(1, 1); Assert.assertEquals("abc", account.getAccountname()); }
@Test @DataSet public void testUpdateAccount() { Account account = new Account(); account.setId(1); account.setAccountname("abc"); account.setSaccountid(1); accountService.updateWithSession(account, "hai79"); SimpleAccount simpleAccount = accountService.findById(1, 1); assertThat(simpleAccount.getAccountname()).isEqualTo("abc"); assertThat(simpleAccount.getIndustry()).isEqualTo(null); }
@DataSet @Test public void testSaveAccount() { List accountList = accountService.findPagableListByCriteria( new SearchRequest<AccountSearchCriteria>( new AccountSearchCriteria(), 0, Integer.MAX_VALUE)); System.out.println("List: " + accountList.size()); Account account = new Account(); account.setAccountname("aaa"); account.setSaccountid(1); accountService.saveWithSession(account, "aaa"); accountList = accountService.findPagableListByCriteria( new SearchRequest<AccountSearchCriteria>( new AccountSearchCriteria(), 0, Integer.MAX_VALUE)); System.out.println("List: " + accountList.size()); }
@Test @DataSet public void testMassUpdate() { List<Integer> updateKeys = Arrays.asList(1, 2, 3); Account account = new Account(); account.setAssignuser("hai79"); account.setIndustry("aaa"); accountService.massUpdateWithSession(account, updateKeys, 1); AccountSearchCriteria criteria = new AccountSearchCriteria(); criteria.setSaccountid(new NumberSearchField(1)); List<SimpleAccount> accountList = accountService.findPagableListByCriteria( new SearchRequest<AccountSearchCriteria>(criteria, 0, Integer.MAX_VALUE)); Assert.assertEquals(3, accountList.size()); for (SimpleAccount account1 : accountList) { Assert.assertEquals("hai79", account1.getAssignuser()); } }