@Test
public void saveTest() {

    Mockito.when(apiService.find(Mockito.anyLong())).thenReturn(scope.getApi());
    Mockito.when(scopeRepository.findByApiIdAndName(Mockito.anyLong(), Mockito.anyString())).thenReturn(null);
    Mockito.when(scopeRepository.save(Mockito.any(Scope.class))).thenReturn(scope);
    Mockito.when(operationRepository.findOne(1L)).thenReturn(operation);
    Mockito.when(operationRepository.findOne(2L)).thenReturn(operation2);
    Mockito.when(operationRepository.findOne(3L)).thenReturn(operation3);
    Scope scopeSaved = scopeService.save(scope.getApi().getId(), scope);
    assertEquals(scope, scopeSaved);
}