@Test
public void acceptNewResourceWithPathExistentInDifferentApi() {

     ResourceDTO res = new ResourceDTO();
     res.setName("name");
     res.setDescription("description");
     Api api = new Api();
     api.setId(10L);
     Api diffApi = new Api();
     diffApi.setId(20L);
     Resource resData = new Resource();
     resData.setApi(diffApi);
     Resource newRes = new Resource();
     newRes.setId(40L);
     newRes.setName("name");
     newRes.setApi(diffApi);
     newRes.setDescription("foo description");
     Mockito.when(apiRepository.findOne(10L)).thenReturn(api);
     Mockito.when(resourceRepository.findByApiIdAndName(Mockito.anyLong(), Mockito.anyString()))
            .thenReturn(resData);
     Mockito.when(resourceRepository.save(Mockito.any(Resource.class))).thenReturn(newRes);
     Resource resource = resourceService.save(10L, res);
     assertEquals(res.getName(), resource.getName());
     assertNotEquals(api.getId(), resource.getApi().getId());
}