Skip to content

Commit

Permalink
Organised imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahil S committed Aug 7, 2024
1 parent 5d5ea7b commit c04062d
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.google.gson.GsonBuilder;
import in.rsh.cab.admin.model.request.BookCabRequest;
import in.rsh.cab.admin.service.BookingService;
import in.rsh.cab.commons.adapter.*;
import java.time.LocalDateTime;
import in.rsh.cab.commons.adapter.LocalDateTimeDeserializer;
import in.rsh.cab.commons.adapter.LocalDateTimeSerializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -14,6 +14,8 @@
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
public class BookingController {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package in.rsh.cab.admin.controller;

import static in.rsh.cab.commons.model.Cab.*;

import com.google.gson.Gson;
import in.rsh.cab.admin.model.request.AddCabRequest;
import in.rsh.cab.admin.model.request.UpdateCabRequest;
Expand All @@ -15,6 +13,8 @@
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import static in.rsh.cab.commons.model.Cab.CabStatus;

@RestController
public class CabController {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package in.rsh.cab.admin.model.request;

import static in.rsh.cab.commons.model.Cab.*;
import static in.rsh.cab.commons.model.Cab.CabStatus;

public record UpdateCabRequest(String state, Integer cityId) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import in.rsh.cab.admin.store.BookingStore;
import in.rsh.cab.commons.model.Booking;
import in.rsh.cab.commons.model.Cab;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

@Service
public class BookingService {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package in.rsh.cab.admin.service;

import static in.rsh.cab.commons.model.Cab.*;

import in.rsh.cab.admin.store.CabStore;
import in.rsh.cab.commons.model.Cab;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import static in.rsh.cab.commons.model.Cab.CabStatus;

@Service
public class CabService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import in.rsh.cab.admin.model.City;
import in.rsh.cab.admin.store.CityStore;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

@Service
public class CityService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import in.rsh.cab.commons.model.Booking;
import in.rsh.cab.commons.model.Location;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Service;

@Service
public class BookingStore {
Expand Down
7 changes: 4 additions & 3 deletions cab-admin/src/main/java/in/rsh/cab/admin/store/CabStore.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package in.rsh.cab.admin.store;

import static in.rsh.cab.commons.model.Cab.*;

import in.rsh.cab.commons.model.Cab;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Service;

import static in.rsh.cab.commons.model.Cab.CabStatus;

@Service
public class CabStore {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package in.rsh.cab.admin.store;

import in.rsh.cab.admin.model.City;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Service;

@Service
public class CityStore {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
package in.rsh.cab.admin.controller;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.hasSize;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.google.gson.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import in.rsh.cab.admin.model.request.AddCabRequest;
import in.rsh.cab.admin.model.request.AddCityRequest;
import in.rsh.cab.admin.model.request.BookCabRequest;
import in.rsh.cab.commons.adapter.LocalDateTimeDeserializer;
import in.rsh.cab.commons.adapter.LocalDateTimeSerializer;
import java.time.LocalDateTime;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -25,6 +16,17 @@
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;

import java.time.LocalDateTime;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.hasSize;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@ExtendWith(SpringExtension.class)
@SpringBootTest
@AutoConfigureMockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;

import java.lang.reflect.Type;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

import java.lang.reflect.Type;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package in.rsh.cab.commons.model;

import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;

import java.time.LocalDateTime;

@Getter
@Builder
public class Booking {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package in.rsh.cab.user.service;

import in.rsh.cab.user.exception.CabNotAvailableException;
import in.rsh.cab.commons.model.Booking;
import in.rsh.cab.commons.model.Cab;
import in.rsh.cab.commons.model.Location;
import in.rsh.cab.user.exception.CabNotAvailableException;
import in.rsh.cab.user.model.Rider;
import in.rsh.cab.user.store.GenericStore;
import in.rsh.cab.user.store.StoreFactory;
import in.rsh.cab.user.util.IDUtil;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import in.rsh.cab.user.store.GenericStore;
import in.rsh.cab.user.store.StoreFactory;
import in.rsh.cab.user.util.IDUtil;

import java.util.Optional;

public class CabService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import in.rsh.cab.commons.model.Cab;
import in.rsh.cab.commons.model.Driver;
import in.rsh.cab.user.model.Rider;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package in.rsh.cab.user.service;

import static org.junit.jupiter.api.Assertions.assertEquals;

import in.rsh.cab.commons.model.Booking;
import in.rsh.cab.commons.model.Cab;
import in.rsh.cab.commons.model.Driver;
Expand All @@ -10,6 +8,8 @@
import in.rsh.cab.user.model.Rider;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class BookingServiceTest {

private final BookingService bookingService = new BookingService();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package in.rsh.cab.user.service;

import static org.junit.jupiter.api.Assertions.assertEquals;

import in.rsh.cab.commons.model.Driver;
import in.rsh.cab.commons.model.DrivingLicense;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class DriverServiceTest {

private final DriverService driverService = new DriverService();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package in.rsh.cab.user.service;

import static org.junit.jupiter.api.Assertions.assertEquals;

import in.rsh.cab.user.model.Rider;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class RiderServiceTest {

private final RiderService riderService = new RiderService();
Expand Down

0 comments on commit c04062d

Please sign in to comment.