Browse Source

Person Find All sorted (error in test fixed)
Fixes #49

Andrew Grant 6 months ago
parent
commit
14d7ed025e

+ 3 - 1
src/test/java/scot/carricksoftware/grants/services/people/PersonServiceFindTest.java

@@ -10,6 +10,7 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
 import org.mockito.junit.jupiter.MockitoExtension;
+import org.springframework.data.domain.Sort;
 import scot.carricksoftware.grants.converters.people.PersonCommandConverterImpl;
 import scot.carricksoftware.grants.converters.people.PersonConverterImpl;
 import scot.carricksoftware.grants.domains.people.Person;
@@ -21,6 +22,7 @@ import java.util.Optional;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.when;
 import static scot.carricksoftware.grants.GenerateRandomNumberValues.GetRandomLong;
 import static scot.carricksoftware.grants.GenerateRandomPeopleValues.GetRandomPerson;
@@ -50,7 +52,7 @@ public class PersonServiceFindTest {
     public void testFindAll() {
         List<Person> countries = new ArrayList<>();
         countries.add(GetRandomPerson());
-        when(personRepositoryMock.findAll()).thenReturn(countries);
+        when(personRepositoryMock.findAll((Sort) any())).thenReturn(countries);
         assertEquals(countries, personService.findAll());
     }