@Test
public void updateTest() {

    Mockito.when(apiService.find(Mockito.anyLong())).thenReturn(scope.getApi());
    Mockito.when(scopeRepository.findByApiIdAndId(Mockito.anyLong(), Mockito.anyLong())).thenReturn(scope);
    scope.setName("Scope new name");
    Mockito.when(scopeRepository.save(scope)).thenReturn(scope);
    Scope updated = scopeService.update(scope.getApi().getId(), scope.getId(), scope);
    assertEquals(scope.getName(), updated.getName());
}