|
9 | 9 | import org.junit.runner.RunWith; |
10 | 10 | import org.slf4j.Logger; |
11 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
12 | | -import org.springframework.test.context.ActiveProfiles; |
13 | 12 | import org.springframework.dao.DataAccessException; |
| 13 | +import org.springframework.test.context.ActiveProfiles; |
14 | 14 | import org.springframework.test.context.ContextConfiguration; |
15 | 15 | import org.springframework.test.context.jdbc.Sql; |
16 | 16 | import org.springframework.test.context.jdbc.SqlConfig; |
17 | 17 | import org.springframework.test.context.junit4.SpringRunner; |
18 | | -import ru.javawebinar.topjava.Profiles; |
| 18 | +import ru.javawebinar.topjava.ActiveDbProfileResolver; |
19 | 19 | import ru.javawebinar.topjava.model.Meal; |
20 | 20 | import ru.javawebinar.topjava.util.exception.NotFoundException; |
21 | 21 |
|
|
35 | 35 | }) |
36 | 36 | @RunWith(SpringRunner.class) |
37 | 37 | @Sql(scripts = "classpath:db/populateDB.sql", config = @SqlConfig(encoding = "UTF-8")) |
38 | | -@ActiveProfiles(Profiles.ACTIVE_DB) |
| 38 | +@ActiveProfiles(resolver = ActiveDbProfileResolver.class) |
39 | 39 | public class MealServiceTest { |
40 | 40 | private static final Logger log = getLogger("result"); |
41 | 41 |
|
@@ -121,7 +121,7 @@ public void update() { |
121 | 121 |
|
122 | 122 | @Test |
123 | 123 | public void updateNotOwn() { |
124 | | - NotFoundException exception = assertThrows(NotFoundException.class, () -> service.update(meal1, ADMIN_ID)); |
| 124 | + NotFoundException exception = assertThrows(NotFoundException.class, () -> service.update(getUpdated(), ADMIN_ID)); |
125 | 125 | Assert.assertEquals("Not found entity with id=" + MEAL1_ID, exception.getMessage()); |
126 | 126 | MEAL_MATCHER.assertMatch(service.get(MEAL1_ID, USER_ID), meal1); |
127 | 127 | } |
|
0 commit comments