main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | package com.example.rezevirajmasa.demo;
|
---|
| 2 |
|
---|
| 3 | import com.example.rezevirajmasa.demo.model.Restaurant;
|
---|
| 4 | import com.example.rezevirajmasa.demo.repository.RestaurantRepository;
|
---|
| 5 | import org.assertj.core.api.Assertions;
|
---|
| 6 | import org.junit.jupiter.api.Test;
|
---|
| 7 | import org.springframework.beans.factory.annotation.Autowired;
|
---|
| 8 | import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
|
---|
| 9 | import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
---|
| 10 | import org.springframework.test.annotation.Rollback;
|
---|
| 11 |
|
---|
| 12 | import java.util.List;
|
---|
| 13 |
|
---|
| 14 | @DataJpaTest
|
---|
| 15 | @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
---|
| 16 | @Rollback(false)
|
---|
| 17 | public class RestController {
|
---|
| 18 | @Autowired private RestaurantRepository restaurantRepository;
|
---|
| 19 |
|
---|
| 20 | @Test
|
---|
| 21 | public void getAllRestaurants() {
|
---|
| 22 | List<Restaurant> restaurantList = restaurantRepository.findAll();
|
---|
| 23 | Assertions.assertThat(restaurantList).hasSizeGreaterThan(0);
|
---|
| 24 |
|
---|
| 25 | for(Restaurant restaurant : restaurantList)
|
---|
| 26 | System.out.println(restaurant);
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.