SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top