2 changed files with 43 additions and 2 deletions
@ -0,0 +1,41 @@ |
|||||
|
package bc.mm.mis.dao; |
||||
|
|
||||
|
|
||||
|
import bc.mm.mis.bean.Country; |
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
import org.springframework.data.domain.Page; |
||||
|
import org.springframework.data.domain.PageRequest; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import static org.junit.jupiter.api.Assertions.*; |
||||
|
|
||||
|
@SpringBootTest |
||||
|
class CountryDaoTest { |
||||
|
@Autowired |
||||
|
private CountryDao countryDao; |
||||
|
|
||||
|
@Test |
||||
|
void findAll() { |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
void dopage() { |
||||
|
PageRequest pagereq = PageRequest.of(0,20); |
||||
|
Page<Country> pageobj = countryDao.findAll(pagereq); |
||||
|
int tt = pageobj.getTotalPages(); |
||||
|
long count = pageobj.getTotalElements(); |
||||
|
|
||||
|
List<Country> countryList =pageobj.getContent(); |
||||
|
|
||||
|
System.out.println(count); |
||||
|
System.out.println(tt); |
||||
|
|
||||
|
// foreach
|
||||
|
countryList.stream().forEach(s->{ |
||||
|
System.out.println(s.getEnName()); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue