Browse Source

Places sorted (2)
Fixed #71

Andrew Grant 5 months ago
parent
commit
ceaadbd881

+ 3 - 1
src/test/java/scot/carricksoftware/grants/services/places/organisations/OrganisationServiceFindTest.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.places.organisations.OrganisationCommandConverterImpl;
 import scot.carricksoftware.grants.converters.places.organisations.OrganisationConverterImpl;
 import scot.carricksoftware.grants.domains.places.Organisation;
@@ -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.GenerateRandomPlaceValues.GetRandomOrganisation;
@@ -50,7 +52,7 @@ public class OrganisationServiceFindTest {
     public void testFindAll() {
         List<Organisation> organisations = new ArrayList<>();
         organisations.add(GetRandomOrganisation());
-        when(organisationRepositoryMock.findAll()).thenReturn(organisations);
+        when(organisationRepositoryMock.findAll(any(Sort.class))).thenReturn(organisations);
         assertEquals(organisations, organisationService.findAll());
     }
 

+ 3 - 1
src/test/java/scot/carricksoftware/grants/services/places/places/PlaceServiceFindTest.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.places.places.PlaceCommandConverterImpl;
 import scot.carricksoftware.grants.converters.places.places.PlaceConverterImpl;
 import scot.carricksoftware.grants.domains.places.Place;
@@ -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.GenerateRandomPlaceValues.GetRandomPlace;
@@ -50,7 +52,7 @@ public class PlaceServiceFindTest {
     public void testFindAll() {
         List<Place> countries = new ArrayList<>();
         countries.add(GetRandomPlace());
-        when(placeRepositoryMock.findAll()).thenReturn(countries);
+        when(placeRepositoryMock.findAll(any(Sort.class))).thenReturn(countries);
         assertEquals(countries, placeService.findAll());
     }
 

+ 3 - 1
src/test/java/scot/carricksoftware/grants/services/places/regions/RegionServiceFindTest.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.places.regions.RegionCommandConverterImpl;
 import scot.carricksoftware.grants.converters.places.regions.RegionConverterImpl;
 import scot.carricksoftware.grants.domains.places.Region;
@@ -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.GenerateRandomPlaceValues.GetRandomRegion;
@@ -50,7 +52,7 @@ public class RegionServiceFindTest {
     public void testFindAll() {
         List<Region> countries = new ArrayList<>();
         countries.add(GetRandomRegion());
-        when(regionRepositoryMock.findAll()).thenReturn(countries);
+        when(regionRepositoryMock.findAll(any(Sort.class))).thenReturn(countries);
         assertEquals(countries, regionService.findAll());
     }