Code example for AbstractTransactionalTestNGSpringContextTests

Methods: asList, assertTrue

0
        assertReflectionEquals(selected.getUsers().get(0), user); 
    } 
 
    @Test 
    public void getByUsernamesShouldReturnEmptyListWhenFoundUsersDoNotExist() { 
        Set<String> existsUsernames = new HashSet<>(asList("Shogun", "jk1", "masyan")); 
 
        List<JCUser> foundByUsernames = dao.getByUsernames(existsUsernames); 
 
        assertTrue(foundByUsernames.isEmpty(), "It should return empty list, cause found users not exist."); 
    } 
 
    @Test 
    public void getUsernamesResultCount() { 
        String usernamePattern = "Us"; 
        int resultCount = 2; 
        createUser("User1", true); 
        createUser("uSer2", true); 
        createUser("user3", true); 
        assertEquals(dao.getUsernames(usernamePattern, resultCount).size(), 2); 
Experience pair programming with AI  Get Codota for Java