use of com.ncedu.fooddelivery.api.v1.entities.Warehouse in project 2021-msk-food-delivery by netcracker-edu.
the class WarehouseServiceTest method getMockActiveWarehouses.
private List<Warehouse> getMockActiveWarehouses() {
List<Warehouse> mockWarehouses = new ArrayList<>();
Point p1 = Mockito.mock(Point.class), p2 = Mockito.mock(Point.class), p3 = Mockito.mock(Point.class), p4 = Mockito.mock(Point.class);
// setting fake distance between each warehouse and client
Mockito.when(p1.distance(Mockito.any(Point.class))).thenReturn(10.0);
Mockito.when(p2.distance(Mockito.any(Point.class))).thenReturn(5.0);
Mockito.when(p3.distance(Mockito.any(Point.class))).thenReturn(15.0);
Mockito.when(p4.distance(Mockito.any(Point.class))).thenReturn(1.0);
Geometry g1 = Mockito.mock(Geometry.class), g2 = Mockito.mock(Geometry.class), g3 = Mockito.mock(Geometry.class), g4 = Mockito.mock(Geometry.class);
// setting
Mockito.when(g1.covers(Mockito.any(Point.class))).thenReturn(true);
Mockito.when(g2.covers(Mockito.any(Point.class))).thenReturn(true);
Mockito.when(g3.covers(Mockito.any(Point.class))).thenReturn(true);
Mockito.when(g4.covers(Mockito.any(Point.class))).thenReturn(false);
Warehouse w1 = new Warehouse(1L, p1, g1, "foo", "bar", true), w2 = new Warehouse(2L, p2, g2, "foo", "bar", true), w3 = new Warehouse(3L, p3, g3, "foo", "bar", true), w4 = new Warehouse(4L, p4, g4, "foo", "bar", true);
mockWarehouses.addAll(Arrays.asList(w1, w2, w3, w4));
return mockWarehouses;
}
Aggregations