|
17 | 17 | @RunWith(SpringJUnit4ClassRunner.class) |
18 | 18 | @ContextConfiguration(classes = { Cause1NonTransientConfig.class }, loader = AnnotationConfigContextLoader.class) |
19 | 19 | public class InvalidResourceUsageExceptionTest { |
20 | | - @Autowired |
21 | | - private IFooService fooService; |
| 20 | + @Autowired |
| 21 | + private IFooService fooService; |
22 | 22 |
|
23 | | - @Autowired |
24 | | - private DataSource restDataSource; |
| 23 | + @Autowired |
| 24 | + private DataSource restDataSource; |
25 | 25 |
|
26 | | - @Test(expected = InvalidDataAccessResourceUsageException.class) |
27 | | - public void whenRetrievingDataUserNoSelectRights_thenInvalidResourceUsageException() { |
28 | | - fooService.findAll(); |
29 | | - } |
| 26 | + @Test(expected = InvalidDataAccessResourceUsageException.class) |
| 27 | + public void whenRetrievingDataUserNoSelectRights_thenInvalidResourceUsageException() { |
| 28 | + final JdbcTemplate jdbcTemplate = new JdbcTemplate(restDataSource); |
| 29 | + jdbcTemplate.execute("revoke select from tutorialuser"); |
30 | 30 |
|
31 | | - @Test(expected = BadSqlGrammarException.class) |
32 | | - public void whenIncorrectSql_thenBadSqlGrammarException() { |
33 | | - final JdbcTemplate jdbcTemplate = new JdbcTemplate(restDataSource); |
| 31 | + fooService.findAll(); |
34 | 32 |
|
35 | | - jdbcTemplate.queryForObject("select * fro foo where id=3", Integer.class); |
36 | | - } |
| 33 | + jdbcTemplate.execute("grant select to tutorialuser"); |
| 34 | + } |
| 35 | + |
| 36 | + @Test(expected = BadSqlGrammarException.class) |
| 37 | + public void whenIncorrectSql_thenBadSqlGrammarException() { |
| 38 | + final JdbcTemplate jdbcTemplate = new JdbcTemplate(restDataSource); |
| 39 | + |
| 40 | + jdbcTemplate.queryForObject("select * fro foo where id=3", Integer.class); |
| 41 | + } |
37 | 42 |
|
38 | 43 | } |
0 commit comments