package com.ruoyi.chargingPile.controller;
|
|
import com.ruoyi.chargingPile.api.dto.TParkingLotDTO;
|
import com.ruoyi.chargingPile.service.TCarportService;
|
import com.ruoyi.chargingPile.service.TParkingLotService;
|
import com.ruoyi.chargingPile.service.TVehicleRampService;
|
import com.ruoyi.common.core.exception.ServiceException;
|
import org.junit.jupiter.api.Test;
|
|
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.mockito.Mockito.mock;
|
|
class TParkingLotControllerTest {
|
|
private final TParkingLotController controller = new TParkingLotController(
|
mock(TParkingLotService.class),
|
mock(TVehicleRampService.class),
|
mock(TCarportService.class)
|
);
|
|
@Test
|
void rejectsShunjieForCooperativeParkingLot() {
|
TParkingLotDTO dto = new TParkingLotDTO();
|
dto.setType(2);
|
dto.setBarrierBrand(1);
|
|
assertThrows(ServiceException.class, () -> controller.add(dto));
|
}
|
|
@Test
|
void allowsShunjieForDirectParkingLot() {
|
TParkingLotDTO dto = new TParkingLotDTO();
|
dto.setType(1);
|
dto.setBarrierBrand(1);
|
|
assertDoesNotThrow(() -> controller.add(dto));
|
}
|
}
|