Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
customer-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
back-end
customer-service
Commits
e1efd106
Commit
e1efd106
authored
Apr 30, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
承运商接口:解绑司机与车辆
parent
63000c7d
Changes
18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
309 additions
and
387 deletions
+309
-387
ErrorMessageComponent.java
...ight/customer/common/component/ErrorMessageComponent.java
+9
-0
DriverVehicleController.java
...mer/module/driver/controller/DriverVehicleController.java
+16
-1
DriverVehicleService.java
.../customer/module/driver/service/DriverVehicleService.java
+10
-1
DriverVehicleServiceImpl.java
.../module/driver/service/impl/DriverVehicleServiceImpl.java
+33
-0
application-dev.yml
src/main/resources/application-dev.yml
+6
-1
CarrierAccountControllerTest.java
...dule/carrier/controller/CarrierAccountControllerTest.java
+15
-44
DriverAccountAddTest.java
...stomer/module/driver/controller/DriverAccountAddTest.java
+8
-24
DriverAccountEditTest.java
...tomer/module/driver/controller/DriverAccountEditTest.java
+7
-21
DriverAccountTest.java
.../customer/module/driver/controller/DriverAccountTest.java
+19
-57
DriverVehicleControllerTest.java
...module/driver/controller/DriverVehicleControllerTest.java
+88
-12
AccountAndAddressControllerTest.java
...oodsowner/controller/AccountAndAddressControllerTest.java
+4
-8
DeliveryAddressControllerTest.java
.../goodsowner/controller/DeliveryAddressControllerTest.java
+12
-24
GoodsOwnerControllerTest.java
...odule/goodsowner/controller/GoodsOwnerControllerTest.java
+25
-50
ReceiveAddressControllerTest.java
...e/goodsowner/controller/ReceiveAddressControllerTest.java
+11
-22
RegularlyRouteControllerTest.java
...e/goodsowner/controller/RegularlyRouteControllerTest.java
+16
-32
VehicleControllerAddTest.java
...r/module/vehicle/controller/VehicleControllerAddTest.java
+8
-24
VehicleControllerEditTest.java
.../module/vehicle/controller/VehicleControllerEditTest.java
+6
-18
VehicleControllerTest.java
...omer/module/vehicle/controller/VehicleControllerTest.java
+16
-48
No files found.
src/main/java/com/esv/freight/customer/common/component/ErrorMessageComponent.java
View file @
e1efd106
...
@@ -235,4 +235,13 @@ public class ErrorMessageComponent {
...
@@ -235,4 +235,13 @@ public class ErrorMessageComponent {
private
String
carrierDriverVehicleBind1020
;
private
String
carrierDriverVehicleBind1020
;
@Value
(
"${error-message.carrier.driver.vehicle-bind.1021}"
)
@Value
(
"${error-message.carrier.driver.vehicle-bind.1021}"
)
private
String
carrierDriverVehicleBind1021
;
private
String
carrierDriverVehicleBind1021
;
@Value
(
"${error-message.carrier.driver.vehicle-unbind.1001}"
)
private
String
carrierDriverVehicleUnbind1001
;
@Value
(
"${error-message.carrier.driver.vehicle-unbind.1010}"
)
private
String
carrierDriverVehicleUnbind1010
;
@Value
(
"${error-message.carrier.driver.vehicle-unbind.1020}"
)
private
String
carrierDriverVehicleUnbind1020
;
@Value
(
"${error-message.carrier.driver.vehicle-unbind.1021}"
)
private
String
carrierDriverVehicleUnbind1021
;
}
}
src/main/java/com/esv/freight/customer/module/driver/controller/DriverVehicleController.java
View file @
e1efd106
...
@@ -7,6 +7,7 @@ import com.esv.freight.customer.module.driver.form.DriverQueryForm;
...
@@ -7,6 +7,7 @@ import com.esv.freight.customer.module.driver.form.DriverQueryForm;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.form.DriverVehicleForm
;
import
com.esv.freight.customer.module.driver.service.DriverVehicleService
;
import
com.esv.freight.customer.module.driver.service.DriverVehicleService
;
import
com.esv.freight.customer.module.driver.validator.groups.ValidatorBind
;
import
com.esv.freight.customer.module.driver.validator.groups.ValidatorBind
;
import
com.esv.freight.customer.module.driver.validator.groups.ValidatorUnbind
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -50,7 +51,7 @@ public class DriverVehicleController {
...
@@ -50,7 +51,7 @@ public class DriverVehicleController {
}
}
/**
/**
* description
司机绑定
车辆
* description
绑定司机与
车辆
* param [form]
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* author Administrator
...
@@ -62,4 +63,18 @@ public class DriverVehicleController {
...
@@ -62,4 +63,18 @@ public class DriverVehicleController {
return
EResponse
.
ok
();
return
EResponse
.
ok
();
}
}
/**
* description 解绑司机与车辆
* param [form]
* return com.esv.freight.customer.common.response.EResponse
* author Administrator
* createTime 2020/04/30 9:53
**/
@PostMapping
(
"/unbind"
)
public
EResponse
unbind
(
@RequestBody
@Validated
(
ValidatorUnbind
.
class
)
DriverVehicleForm
form
)
throws
EException
{
driverVehicleService
.
driverUnbindVehicle
(
form
);
return
EResponse
.
ok
();
}
}
}
src/main/java/com/esv/freight/customer/module/driver/service/DriverVehicleService.java
View file @
e1efd106
...
@@ -26,7 +26,7 @@ public interface DriverVehicleService {
...
@@ -26,7 +26,7 @@ public interface DriverVehicleService {
List
<
DriverVehicleListVO
>
getDriverBindVehicleList
(
Long
id
);
List
<
DriverVehicleListVO
>
getDriverBindVehicleList
(
Long
id
);
/**
/**
* description
司机绑定
车辆
* description
绑定司机与
车辆
* param [form]
* param [form]
* return java.lang.Integer
* return java.lang.Integer
* author Administrator
* author Administrator
...
@@ -34,4 +34,13 @@ public interface DriverVehicleService {
...
@@ -34,4 +34,13 @@ public interface DriverVehicleService {
**/
**/
Integer
driverBindVehicle
(
DriverVehicleForm
form
);
Integer
driverBindVehicle
(
DriverVehicleForm
form
);
/**
* description 解绑司机与车辆
* param [form]
* return java.lang.Integer
* author Administrator
* createTime 2020/04/30 9:38
**/
Integer
driverUnbindVehicle
(
DriverVehicleForm
form
);
}
}
src/main/java/com/esv/freight/customer/module/driver/service/impl/DriverVehicleServiceImpl.java
View file @
e1efd106
...
@@ -115,4 +115,37 @@ public class DriverVehicleServiceImpl implements DriverVehicleService {
...
@@ -115,4 +115,37 @@ public class DriverVehicleServiceImpl implements DriverVehicleService {
vehicleDriverEntity
.
setOperateUser
(
ReqUtils
.
getRequestUserAccount
());
vehicleDriverEntity
.
setOperateUser
(
ReqUtils
.
getRequestUserAccount
());
return
this
.
vehicleDriverService
.
getBaseMapper
().
insert
(
vehicleDriverEntity
);
return
this
.
vehicleDriverService
.
getBaseMapper
().
insert
(
vehicleDriverEntity
);
}
}
@Override
public
Integer
driverUnbindVehicle
(
DriverVehicleForm
form
)
{
// 1:校验
// 1.1:校验司机ID是否有效
DriverAccountEntity
driverAccountEntity
=
this
.
driverAccountService
.
getById
(
form
.
getDriverId
());
if
(
null
==
driverAccountEntity
)
{
throw
new
EException
(
1001
,
errorMessageComponent
.
getCarrierDriverVehicleUnbind1001
());
}
String
driverAccount
=
driverAccountEntity
.
getAccount
();
// 1.2:校验车辆ID是否有效
VehicleEntity
vehicleEntity
=
this
.
vehicleService
.
getById
(
form
.
getVehicleId
());
if
(
null
==
vehicleEntity
)
{
throw
new
EException
(
1010
,
errorMessageComponent
.
getCarrierDriverVehicleUnbind1010
());
}
// 1.3:校验车辆与司机是否绑定
VehicleDriverEntity
vehicleDriverEntity
=
this
.
vehicleDriverService
.
getBaseMapper
().
selectOne
(
new
QueryWrapper
<
VehicleDriverEntity
>().
lambda
()
.
eq
(
VehicleDriverEntity:
:
getVehicleId
,
form
.
getVehicleId
())
.
eq
(
VehicleDriverEntity:
:
getDriverId
,
form
.
getDriverId
()));
if
(
null
==
vehicleDriverEntity
)
{
throw
new
EException
(
1020
,
errorMessageComponent
.
getCarrierDriverVehicleUnbind1020
());
}
// 1.4:校验司机自主绑定的车辆,平台不可解绑
if
(
VehicleConstants
.
VEHICLE_SOURCE_TYPE_REGISTER
.
equals
(
vehicleEntity
.
getSourceType
())
&&
driverAccount
.
equals
(
vehicleEntity
.
getCreateUser
()))
{
throw
new
EException
(
1021
,
errorMessageComponent
.
getCarrierDriverVehicleUnbind1021
());
}
// 1:解绑司机与车辆
return
this
.
vehicleDriverService
.
getBaseMapper
().
delete
(
new
QueryWrapper
<
VehicleDriverEntity
>().
lambda
()
.
eq
(
VehicleDriverEntity:
:
getVehicleId
,
form
.
getVehicleId
())
.
eq
(
VehicleDriverEntity:
:
getDriverId
,
form
.
getDriverId
()));
}
}
}
src/main/resources/application-dev.yml
View file @
e1efd106
...
@@ -184,3 +184,8 @@ error-message:
...
@@ -184,3 +184,8 @@ error-message:
1012
:
车辆未审核通过
1012
:
车辆未审核通过
1020
:
司机与车辆所属承运商不一致
1020
:
司机与车辆所属承运商不一致
1021
:
重复绑定
1021
:
重复绑定
vehicle-unbind
:
1001
:
无效的司机ID
1010
:
无效的车辆ID
1020
:
车辆与司机未绑定
1021
:
司机自主绑定的车辆,平台不可解绑
\ No newline at end of file
src/test/java/com/esv/freight/customer/module/carrier/controller/CarrierAccountControllerTest.java
View file @
e1efd106
This diff is collapsed.
Click to expand it.
src/test/java/com/esv/freight/customer/module/driver/controller/DriverAccountAddTest.java
View file @
e1efd106
...
@@ -74,12 +74,10 @@ public class DriverAccountAddTest extends BaseTestController {
...
@@ -74,12 +74,10 @@ public class DriverAccountAddTest extends BaseTestController {
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_1
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_1
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -131,12 +129,10 @@ public class DriverAccountAddTest extends BaseTestController {
...
@@ -131,12 +129,10 @@ public class DriverAccountAddTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -189,12 +185,10 @@ public class DriverAccountAddTest extends BaseTestController {
...
@@ -189,12 +185,10 @@ public class DriverAccountAddTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -246,12 +240,10 @@ public class DriverAccountAddTest extends BaseTestController {
...
@@ -246,12 +240,10 @@ public class DriverAccountAddTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -303,12 +295,10 @@ public class DriverAccountAddTest extends BaseTestController {
...
@@ -303,12 +295,10 @@ public class DriverAccountAddTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -360,12 +350,10 @@ public class DriverAccountAddTest extends BaseTestController {
...
@@ -360,12 +350,10 @@ public class DriverAccountAddTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -414,12 +402,10 @@ public class DriverAccountAddTest extends BaseTestController {
...
@@ -414,12 +402,10 @@ public class DriverAccountAddTest extends BaseTestController {
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_2
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_2
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -468,12 +454,10 @@ public class DriverAccountAddTest extends BaseTestController {
...
@@ -468,12 +454,10 @@ public class DriverAccountAddTest extends BaseTestController {
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_1
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_1
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
...
src/test/java/com/esv/freight/customer/module/driver/controller/DriverAccountEditTest.java
View file @
e1efd106
...
@@ -74,12 +74,10 @@ public class DriverAccountEditTest extends BaseTestController {
...
@@ -74,12 +74,10 @@ public class DriverAccountEditTest extends BaseTestController {
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_1
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_1
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -130,12 +128,10 @@ public class DriverAccountEditTest extends BaseTestController {
...
@@ -130,12 +128,10 @@ public class DriverAccountEditTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -186,12 +182,10 @@ public class DriverAccountEditTest extends BaseTestController {
...
@@ -186,12 +182,10 @@ public class DriverAccountEditTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -242,12 +236,10 @@ public class DriverAccountEditTest extends BaseTestController {
...
@@ -242,12 +236,10 @@ public class DriverAccountEditTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -298,12 +290,10 @@ public class DriverAccountEditTest extends BaseTestController {
...
@@ -298,12 +290,10 @@ public class DriverAccountEditTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -354,12 +344,10 @@ public class DriverAccountEditTest extends BaseTestController {
...
@@ -354,12 +344,10 @@ public class DriverAccountEditTest extends BaseTestController {
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setCertificateUrl
(
"http://127.0.0.1/certificate_url_18512340002.jpg"
);
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -408,12 +396,10 @@ public class DriverAccountEditTest extends BaseTestController {
...
@@ -408,12 +396,10 @@ public class DriverAccountEditTest extends BaseTestController {
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_2
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setCertificateVehicle
(
DriverConstants
.
ACCOUNT_DRIVING_VEHICLE_TYPE_2
);
// 道路运输从业资格证-所驾驶车辆(字典表):1-4.5吨及以下、2-4.5吨以上
form
.
setRemark
(
"测试数据"
);
form
.
setRemark
(
"测试数据"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
...
src/test/java/com/esv/freight/customer/module/driver/controller/DriverAccountTest.java
View file @
e1efd106
This diff is collapsed.
Click to expand it.
src/test/java/com/esv/freight/customer/module/driver/controller/DriverVehicleControllerTest.java
View file @
e1efd106
...
@@ -49,12 +49,10 @@ public class DriverVehicleControllerTest extends BaseTestController {
...
@@ -49,12 +49,10 @@ public class DriverVehicleControllerTest extends BaseTestController {
DriverQueryForm
form
=
new
DriverQueryForm
();
DriverQueryForm
form
=
new
DriverQueryForm
();
form
.
setId
(
1L
);
form
.
setId
(
1L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -78,12 +76,10 @@ public class DriverVehicleControllerTest extends BaseTestController {
...
@@ -78,12 +76,10 @@ public class DriverVehicleControllerTest extends BaseTestController {
DriverQueryForm
form
=
new
DriverQueryForm
();
DriverQueryForm
form
=
new
DriverQueryForm
();
form
.
setId
(
99999L
);
form
.
setId
(
99999L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -106,12 +102,10 @@ public class DriverVehicleControllerTest extends BaseTestController {
...
@@ -106,12 +102,10 @@ public class DriverVehicleControllerTest extends BaseTestController {
DriverQueryForm
form
=
new
DriverQueryForm
();
DriverQueryForm
form
=
new
DriverQueryForm
();
form
.
setId
(
2L
);
form
.
setId
(
2L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -124,7 +118,7 @@ public class DriverVehicleControllerTest extends BaseTestController {
...
@@ -124,7 +118,7 @@ public class DriverVehicleControllerTest extends BaseTestController {
}
}
/**
/**
*
司机绑定
车辆
*
绑定司机与
车辆
**/
**/
@Test
@Test
@Rollback
@Rollback
...
@@ -136,12 +130,38 @@ public class DriverVehicleControllerTest extends BaseTestController {
...
@@ -136,12 +130,38 @@ public class DriverVehicleControllerTest extends BaseTestController {
form
.
setDriverId
(
3L
);
form
.
setDriverId
(
3L
);
form
.
setVehicleId
(
4L
);
form
.
setVehicleId
(
4L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
form
.
toString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
}
/**
* 解绑司机与车辆
**/
@Test
@Rollback
public
void
c1_unbind_success_test
()
throws
Exception
{
String
url
=
"/carrier/driver/vehicle/unbind"
;
// 构造数据
DriverVehicleForm
form
=
new
DriverVehicleForm
();
form
.
setDriverId
(
3L
);
form
.
setVehicleId
(
4L
);
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -152,4 +172,60 @@ public class DriverVehicleControllerTest extends BaseTestController {
...
@@ -152,4 +172,60 @@ public class DriverVehicleControllerTest extends BaseTestController {
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
Assert
.
assertEquals
(
ECode
.
SUCCESS
.
code
(),
result
.
getIntValue
(
"code"
));
}
}
/**
* 解绑司机与车辆:司机自主绑定的车辆,平台不可解绑
**/
@Test
@Rollback
public
void
c2_unbind_driver_add_vehicle_failure_test
()
throws
Exception
{
String
url
=
"/carrier/driver/vehicle/unbind"
;
// 构造数据
DriverVehicleForm
form
=
new
DriverVehicleForm
();
form
.
setDriverId
(
3L
);
form
.
setVehicleId
(
4L
);
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
form
.
toString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
1021
,
result
.
getIntValue
(
"code"
));
}
/**
* 解绑司机与车辆:车辆与司机未绑定
**/
@Test
@Rollback
public
void
c3_unbind_not_bind_failure_test
()
throws
Exception
{
String
url
=
"/carrier/driver/vehicle/unbind"
;
// 构造数据
DriverVehicleForm
form
=
new
DriverVehicleForm
();
form
.
setDriverId
(
3L
);
form
.
setVehicleId
(
3L
);
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
form
.
toString
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
String
responseStr
=
mvcResult
.
getResponse
().
getContentAsString
();
log
.
info
(
responseStr
);
JSONObject
result
=
JSONObject
.
parseObject
(
responseStr
);
Assert
.
assertEquals
(
1020
,
result
.
getIntValue
(
"code"
));
}
}
}
src/test/java/com/esv/freight/customer/module/goodsowner/controller/AccountAndAddressControllerTest.java
View file @
e1efd106
...
@@ -49,12 +49,11 @@ public class AccountAndAddressControllerTest extends BaseTestController {
...
@@ -49,12 +49,11 @@ public class AccountAndAddressControllerTest extends BaseTestController {
form
.
setOwnerId
(
1L
);
form
.
setOwnerId
(
1L
);
form
.
setDeliveryAddressId
(
7L
);
form
.
setDeliveryAddressId
(
7L
);
form
.
setReceiveAddressId
(
5L
);
form
.
setReceiveAddressId
(
5L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -81,12 +80,11 @@ public class AccountAndAddressControllerTest extends BaseTestController {
...
@@ -81,12 +80,11 @@ public class AccountAndAddressControllerTest extends BaseTestController {
form
.
setOwnerId
(
99999L
);
form
.
setOwnerId
(
99999L
);
form
.
setDeliveryAddressId
(
7L
);
form
.
setDeliveryAddressId
(
7L
);
form
.
setReceiveAddressId
(
5L
);
form
.
setReceiveAddressId
(
5L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -110,12 +108,11 @@ public class AccountAndAddressControllerTest extends BaseTestController {
...
@@ -110,12 +108,11 @@ public class AccountAndAddressControllerTest extends BaseTestController {
form
.
setOwnerId
(
1L
);
form
.
setOwnerId
(
1L
);
form
.
setDeliveryAddressId
(
99999L
);
form
.
setDeliveryAddressId
(
99999L
);
form
.
setReceiveAddressId
(
5L
);
form
.
setReceiveAddressId
(
5L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -139,12 +136,11 @@ public class AccountAndAddressControllerTest extends BaseTestController {
...
@@ -139,12 +136,11 @@ public class AccountAndAddressControllerTest extends BaseTestController {
form
.
setOwnerId
(
1L
);
form
.
setOwnerId
(
1L
);
form
.
setDeliveryAddressId
(
7L
);
form
.
setDeliveryAddressId
(
7L
);
form
.
setReceiveAddressId
(
99999L
);
form
.
setReceiveAddressId
(
99999L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
...
src/test/java/com/esv/freight/customer/module/goodsowner/controller/DeliveryAddressControllerTest.java
View file @
e1efd106
...
@@ -58,12 +58,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -58,12 +58,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464052"
);
form
.
setLon
(
"123.464052"
);
form
.
setLat
(
"41.800415"
);
form
.
setLat
(
"41.800415"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -97,12 +96,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -97,12 +96,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
form
.
setLon
(
"123.464052"
);
form
.
setLon
(
"123.464052"
);
form
.
setLat
(
"41.800415"
);
form
.
setLat
(
"41.800415"
);
form
.
setAddressCopy
(
"1"
);
form
.
setAddressCopy
(
"1"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -136,12 +134,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -136,12 +134,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464052"
);
form
.
setLon
(
"123.464052"
);
form
.
setLat
(
"41.800415"
);
form
.
setLat
(
"41.800415"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -174,12 +171,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -174,12 +171,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464052"
);
form
.
setLon
(
"123.464052"
);
form
.
setLat
(
"41.800415"
);
form
.
setLat
(
"41.800415"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -213,12 +209,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -213,12 +209,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464053"
);
form
.
setLon
(
"123.464053"
);
form
.
setLat
(
"41.800416"
);
form
.
setLat
(
"41.800416"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -252,12 +247,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -252,12 +247,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464053"
);
form
.
setLon
(
"123.464053"
);
form
.
setLat
(
"41.800416"
);
form
.
setLat
(
"41.800416"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -291,12 +285,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -291,12 +285,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setDelivererTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464053"
);
form
.
setLon
(
"123.464053"
);
form
.
setLat
(
"41.800416"
);
form
.
setLat
(
"41.800416"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -319,12 +312,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -319,12 +312,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
// 构造数据
// 构造数据
DeleteAddressForm
form
=
new
DeleteAddressForm
();
DeleteAddressForm
form
=
new
DeleteAddressForm
();
form
.
setId
(
"1,2,3,4,5"
);
form
.
setId
(
"1,2,3,4,5"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -348,12 +340,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -348,12 +340,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
// 构造数据
// 构造数据
DeliveryAddressForm
form
=
new
DeliveryAddressForm
();
DeliveryAddressForm
form
=
new
DeliveryAddressForm
();
form
.
setId
(
5L
);
form
.
setId
(
5L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -377,12 +368,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -377,12 +368,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
// 构造数据
// 构造数据
DeliveryAddressForm
form
=
new
DeliveryAddressForm
();
DeliveryAddressForm
form
=
new
DeliveryAddressForm
();
form
.
setId
(
9999L
);
form
.
setId
(
9999L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -405,12 +395,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -405,12 +395,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
// 构造数据
// 构造数据
DeliveryAddressForm
form
=
new
DeliveryAddressForm
();
DeliveryAddressForm
form
=
new
DeliveryAddressForm
();
form
.
setOwnerId
(
1L
);
form
.
setOwnerId
(
1L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -434,12 +423,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
...
@@ -434,12 +423,11 @@ public class DeliveryAddressControllerTest extends BaseTestController {
DeliveryAddressForm
form
=
new
DeliveryAddressForm
();
DeliveryAddressForm
form
=
new
DeliveryAddressForm
();
form
.
setPageNum
(
1
);
form
.
setPageNum
(
1
);
form
.
setPageSize
(
10
);
form
.
setPageSize
(
10
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
...
src/test/java/com/esv/freight/customer/module/goodsowner/controller/GoodsOwnerControllerTest.java
View file @
e1efd106
This diff is collapsed.
Click to expand it.
src/test/java/com/esv/freight/customer/module/goodsowner/controller/ReceiveAddressControllerTest.java
View file @
e1efd106
...
@@ -59,12 +59,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -59,12 +59,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464052"
);
form
.
setLon
(
"123.464052"
);
form
.
setLat
(
"41.800415"
);
form
.
setLat
(
"41.800415"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -98,12 +97,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -98,12 +97,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464052"
);
form
.
setLon
(
"123.464052"
);
form
.
setLat
(
"41.800415"
);
form
.
setLat
(
"41.800415"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -136,12 +134,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -136,12 +134,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464052"
);
form
.
setLon
(
"123.464052"
);
form
.
setLat
(
"41.800415"
);
form
.
setLat
(
"41.800415"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -174,12 +171,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -174,12 +171,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464053"
);
form
.
setLon
(
"123.464053"
);
form
.
setLat
(
"41.800416"
);
form
.
setLat
(
"41.800416"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -213,12 +209,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -213,12 +209,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464053"
);
form
.
setLon
(
"123.464053"
);
form
.
setLat
(
"41.800416"
);
form
.
setLat
(
"41.800416"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -252,12 +247,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -252,12 +247,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setReceiverTelephone
(
"(024)24850576"
);
form
.
setLon
(
"123.464053"
);
form
.
setLon
(
"123.464053"
);
form
.
setLat
(
"41.800416"
);
form
.
setLat
(
"41.800416"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -280,12 +274,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -280,12 +274,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
// 构造数据
// 构造数据
DeleteAddressForm
form
=
new
DeleteAddressForm
();
DeleteAddressForm
form
=
new
DeleteAddressForm
();
form
.
setId
(
"1,2,3,4,5"
);
form
.
setId
(
"1,2,3,4,5"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -309,12 +302,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -309,12 +302,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
// 构造数据
// 构造数据
ReceiveAddressForm
form
=
new
ReceiveAddressForm
();
ReceiveAddressForm
form
=
new
ReceiveAddressForm
();
form
.
setId
(
3L
);
form
.
setId
(
3L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -338,12 +330,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -338,12 +330,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
// 构造数据
// 构造数据
ReceiveAddressForm
form
=
new
ReceiveAddressForm
();
ReceiveAddressForm
form
=
new
ReceiveAddressForm
();
form
.
setId
(
9999L
);
form
.
setId
(
9999L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -366,12 +357,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -366,12 +357,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
// 构造数据
// 构造数据
ReceiveAddressForm
form
=
new
ReceiveAddressForm
();
ReceiveAddressForm
form
=
new
ReceiveAddressForm
();
form
.
setOwnerId
(
1L
);
form
.
setOwnerId
(
1L
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -395,12 +385,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
...
@@ -395,12 +385,11 @@ public class ReceiveAddressControllerTest extends BaseTestController {
ReceiveAddressForm
form
=
new
ReceiveAddressForm
();
ReceiveAddressForm
form
=
new
ReceiveAddressForm
();
form
.
setPageNum
(
1
);
form
.
setPageNum
(
1
);
form
.
setPageSize
(
10
);
form
.
setPageSize
(
10
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
...
src/test/java/com/esv/freight/customer/module/goodsowner/controller/RegularlyRouteControllerTest.java
View file @
e1efd106
This diff is collapsed.
Click to expand it.
src/test/java/com/esv/freight/customer/module/vehicle/controller/VehicleControllerAddTest.java
View file @
e1efd106
...
@@ -83,12 +83,10 @@ public class VehicleControllerAddTest extends BaseTestController {
...
@@ -83,12 +83,10 @@ public class VehicleControllerAddTest extends BaseTestController {
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_001.jpg"
);
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_001.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_001.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_001.jpg"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -146,12 +144,10 @@ public class VehicleControllerAddTest extends BaseTestController {
...
@@ -146,12 +144,10 @@ public class VehicleControllerAddTest extends BaseTestController {
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -210,12 +206,10 @@ public class VehicleControllerAddTest extends BaseTestController {
...
@@ -210,12 +206,10 @@ public class VehicleControllerAddTest extends BaseTestController {
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -273,12 +267,10 @@ public class VehicleControllerAddTest extends BaseTestController {
...
@@ -273,12 +267,10 @@ public class VehicleControllerAddTest extends BaseTestController {
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -336,12 +328,10 @@ public class VehicleControllerAddTest extends BaseTestController {
...
@@ -336,12 +328,10 @@ public class VehicleControllerAddTest extends BaseTestController {
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -399,12 +389,10 @@ public class VehicleControllerAddTest extends BaseTestController {
...
@@ -399,12 +389,10 @@ public class VehicleControllerAddTest extends BaseTestController {
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -462,12 +450,10 @@ public class VehicleControllerAddTest extends BaseTestController {
...
@@ -462,12 +450,10 @@ public class VehicleControllerAddTest extends BaseTestController {
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -525,12 +511,10 @@ public class VehicleControllerAddTest extends BaseTestController {
...
@@ -525,12 +511,10 @@ public class VehicleControllerAddTest extends BaseTestController {
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_011.jpg"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
...
src/test/java/com/esv/freight/customer/module/vehicle/controller/VehicleControllerEditTest.java
View file @
e1efd106
...
@@ -84,12 +84,10 @@ public class VehicleControllerEditTest extends BaseTestController {
...
@@ -84,12 +84,10 @@ public class VehicleControllerEditTest extends BaseTestController {
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_001.jpg"
);
form
.
setRoadCertificateFrontUrl
(
"http://127.0.0.1/Road_Certificate_Front_Url_001.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_001.jpg"
);
form
.
setAttachedStatementUrl
(
"http://127.0.0.1/Attached_Statement_Url_001.jpg"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -127,12 +125,10 @@ public class VehicleControllerEditTest extends BaseTestController {
...
@@ -127,12 +125,10 @@ public class VehicleControllerEditTest extends BaseTestController {
form
.
setLoadCapacity
(
new
BigDecimal
(
"4.0"
));
form
.
setLoadCapacity
(
new
BigDecimal
(
"4.0"
));
form
.
setTotalMass
(
new
BigDecimal
(
"5.1"
));
form
.
setTotalMass
(
new
BigDecimal
(
"5.1"
));
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -156,12 +152,10 @@ public class VehicleControllerEditTest extends BaseTestController {
...
@@ -156,12 +152,10 @@ public class VehicleControllerEditTest extends BaseTestController {
form
.
setId
(
1L
);
form
.
setId
(
1L
);
form
.
setLicenseNumber
(
"辽A12302"
);
form
.
setLicenseNumber
(
"辽A12302"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -185,12 +179,10 @@ public class VehicleControllerEditTest extends BaseTestController {
...
@@ -185,12 +179,10 @@ public class VehicleControllerEditTest extends BaseTestController {
form
.
setId
(
1L
);
form
.
setId
(
1L
);
form
.
setVehicleLicenseNumber
(
"210101123457"
);
form
.
setVehicleLicenseNumber
(
"210101123457"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -214,12 +206,10 @@ public class VehicleControllerEditTest extends BaseTestController {
...
@@ -214,12 +206,10 @@ public class VehicleControllerEditTest extends BaseTestController {
form
.
setId
(
1L
);
form
.
setId
(
1L
);
form
.
setRoadCertificateNumber
(
"510184010714"
);
form
.
setRoadCertificateNumber
(
"510184010714"
);
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
@@ -243,12 +233,10 @@ public class VehicleControllerEditTest extends BaseTestController {
...
@@ -243,12 +233,10 @@ public class VehicleControllerEditTest extends BaseTestController {
form
.
setId
(
1L
);
form
.
setId
(
1L
);
form
.
setLoadCapacity
(
new
BigDecimal
(
"5.0"
));
form
.
setLoadCapacity
(
new
BigDecimal
(
"5.0"
));
JSONObject
reqJson
=
JSONObject
.
parseObject
(
form
.
toString
());
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
MvcResult
mvcResult
=
this
.
getMockMvc
().
perform
(
MockMvcRequestBuilders
.
post
(
url
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
contentType
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
.
headers
(
this
.
getDefaultHttpHeaders
())
.
headers
(
this
.
getDefaultHttpHeaders
())
.
content
(
reqJson
.
toJSON
String
()))
.
content
(
form
.
to
String
()))
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andDo
(
MockMvcResultHandlers
.
print
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
())
.
andReturn
();
.
andReturn
();
...
...
src/test/java/com/esv/freight/customer/module/vehicle/controller/VehicleControllerTest.java
View file @
e1efd106
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment