Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. package com.github.jbleduigou.beer.service;
  2.  
  3. @RunWith(MockitoJUnitRunner.class)
  4. public class BeerServiceTest {
  5.  
  6. @InjectMocks
  7. private BeerService service;
  8.  
  9. @Mock
  10. private BeerRepository repository;
  11.  
  12. @Test
  13. public void getBeerShouldThrowExceptionGivenNotFound() {
  14. try {
  15. service.getBeerById(3457L);
  16. catch (EntityNotFoundException e) {
  17. assertThat(e.getMessage(), is("Beer with id=3457 not found"));
  18. return;
  19. }
  20. fail("No exception thrown");
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement