@Test
public void notPermitToSaveAccessTokenWithInvalidApp() {

     thrown.expect(BadRequestException.class);
     thrown.expectMessage("App does not exist");
     
     AccessTokenPersist persist = new AccessTokenPersist();
     persist.setApp(new ReferenceIdDTO(10L));
     
     Mockito.when(accessTokenRepository.findByCode(Mockito.anyString())).thenReturn(null);
     Mockito.when(appRespository.findOne(Mockito.anyLong())).thenReturn(null);
     
     service.save(persist);
     
     Mockito.verify(accessTokenRepository, Mockito.times(1)).save(Mockito.any(AccessToken.class));
     Mockito.verify(accessTokenRepository, Mockito.times(1)).findByCode(Mockito.anyString());
}