Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
4274c35e
Commit
4274c35e
authored
Mar 04, 2022
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增静态类测试
parent
049958b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
shopping-cart-application-service/src/test/spock/cn/freemud/service/impl/FishermanSpock.groovy
+4
-4
No files found.
shopping-cart-application-service/src/test/spock/cn/freemud/service/impl/FishermanSpock.groovy
View file @
4274c35e
...
...
@@ -25,6 +25,7 @@ import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo
import
com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager
import
org.junit.runner.RunWith
import
org.powermock.api.mockito.PowerMockito
import
org.powermock.api.support.membermodification.MemberMatcher
import
org.powermock.core.classloader.annotations.PrepareForTest
import
org.powermock.modules.junit4.PowerMockRunner
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
...
...
@@ -39,7 +40,7 @@ import spock.lang.Specification
*/
@RunWith
(
PowerMockRunner
.
class
)
@PowerMockRunnerDelegate
(
Sputnik
.
class
)
@PrepareForTest
(
ExceptionUtils
.
class
)
@PrepareForTest
(
PromotionFactory
.
class
)
class
FishermanSpock
extends
Specification
{
def
shoppingCartNewServiceImpl
=
new
ShoppingCartNewServiceImpl
()
def
activityAdapter
=
new
ActivityAdapter
()
...
...
@@ -79,7 +80,7 @@ class FishermanSpock extends Specification {
itemService
.
storeItemAdapter
=
storeItemAdapter
itemService
.
storeItemClient
=
productClient
// mock静态类
//
PowerMockito.mockStatic(PromotionFactory.class)
PowerMockito
.
mockStatic
(
PromotionFactory
.
class
)
}
def
"测试 getShoppingCartGoods 订单调用购物车获取结算金额"
()
{
...
...
@@ -92,7 +93,6 @@ class FishermanSpock extends Specification {
def
customerInfoVo
=
JSON
.
parseObject
(
"{\"accessToken\":\"\",\"alipayUserId\":\"\",\"appId\":\"wx3f7ca0c75b213380\",\"appSecret\":\"\",\"appsecret\":\"\",\"channel\":\"1\",\"customerId\":\"\",\"devBrand\":\"\",\"devModel\":\"\",\"iappId\":\"7\",\"memberId\":\"3614319825989629832\",\"mobile\":\"17327190802\",\"newMember\":false,\"nickName\":\"SWEET SUGA\",\"openId\":\"o98fP4qjUo7xm-nT-JAaVEk9yBqM\",\"openid\":\"o98fP4qjUo7xm-nT-JAaVEk9yBqM\",\"partnerId\":\"2581\",\"photoUrl\":\"https://thirdwx.qlogo.cn/mmopen/vi_32/zahIlicTNSM0IA0qjOryv6s0SzIhlwW9EpQKvL63GbPhBwficMAibDohDEibSCQU0I5KohibIpp0yL57TWRcVKrRH2A/132\",\"registerTime\":\"2021-02-26 14:10:26\",\"sessionId\":\"eac53a53f8ae62def7f40cb1e47a1bd9791d95a8\",\"sessionKey\":\"GCyyapzbBSM4yXh9AduGOw==\",\"session_key\":\"GCyyapzbBSM4yXh9AduGOw==\",\"storeId\":\"\",\"tableNumber\":\"\",\"thirdPartyMemberID\":\"\",\"thirdPartyPartnerID\":\"\",\"unionId\":\"o7cEm68JPFhbrzqb0a0BcQE-dDVA\",\"wxAppId\":\"wx3f7ca0c75b213380\",\"wxAppid\":\"wx3f7ca0c75b213380\"}"
,
AssortmentCustomerInfoVo
.
class
)
def
activityCalculationDiscountResponseDto
=
JSON
.
parseObject
(
"{\"msg\":\"成功\",\"result\":{\"apportionGoods\":[{\"apportionAmount\":0,\"apportionDetails\":[],\"cartGoodsUid\":\"6dabf892-901b-40b8-a985-5c097c905678\",\"goodsId\":\"201889968054882060\",\"goodsQuantity\":1,\"nowPrice\":500,\"originalPrice\":500},{\"apportionAmount\":800,\"apportionDetails\":[{\"activityApportionAmount\":800,\"activityCode\":\"88709227085491207040\",\"activityName\":\"鸡米花买一送一券\",\"activityType\":330,\"apportionType\":-1}],\"cartGoodsUid\":\"d0fb5162-2f51-4e8c-9e61-fadade791483\",\"goodsId\":\"201889966261817090\",\"goodsQuantity\":1,\"nowPrice\":0,\"originalPrice\":800},{\"apportionAmount\":0,\"apportionDetails\":[],\"cartGoodsUid\":\"d0fb5162-2f51-4e8c-9e61-fadade791483\",\"goodsId\":\"201889966261817090\",\"goodsQuantity\":1,\"nowPrice\":800,\"originalPrice\":800}],\"couponDiscounts\":[{\"activityName\":\"鸡米花买一送一券\",\"activityType\":330,\"couponCode\":\"88709227085491207040\",\"discountAmount\":800}],\"discounts\":[{\"activityName\":\"鸡米花买一送一券\",\"discount\":800}],\"goods\":[{\"cartGoodType\":0,\"cartGoodsUid\":\"6dabf892-901b-40b8-a985-5c097c905678\",\"discountAmount\":0,\"discounts\":[],\"gift\":false,\"goodsId\":\"201889968054882060\",\"goodsQuantity\":1,\"meal\":false,\"nowPrice\":500,\"originalPrice\":500,\"realAmount\":500,\"score\":0,\"smallMaterial\":[]},{\"actualGoodsNumber\":1,\"cartGoodType\":0,\"cartGoodsUid\":\"d0fb5162-2f51-4e8c-9e61-fadade791483\",\"discountAmount\":800,\"discounts\":[{\"activityCode\":\"88709227085491207040\",\"activityName\":\"鸡米花买一送一券\",\"actualGoodsNumber\":1,\"addOnQuantity\":0,\"discount\":800,\"goodsId\":\"201889966261817090\",\"signleDiscount\":800,\"type\":330}],\"gift\":false,\"goodsId\":\"201889966261817090\",\"goodsQuantity\":2,\"meal\":false,\"nowPrice\":800,\"originalPrice\":800,\"realAmount\":800,\"score\":0,\"smallMaterial\":[]}],\"isScoreLimit\":0,\"nightDistributionFee\":0,\"originalTotalAmount\":2100,\"stocks\":[],\"totalAmount\":1300,\"totalDiscountAmount\":800,\"v3Promotion\":false},\"statusCode\":\"100\",\"ver\":1}"
,
ActivityCalculationDiscountResponseDto
.
class
)
...
...
@@ -121,7 +121,7 @@ class FishermanSpock extends Specification {
and:
"调三方反馈参数 为自己的参数对象 "
customerInfoManager
.
getCustomerInfoByObject
(
"eac53a53f8ae62def7f40cb1e47a1bd9791d95a8"
)
>>
customerInfoVo
customerInfoManager
.
getCustomerInfoByObject
(
_
)
>>
customerInfoVo
assortmentSdkService
.
getShoppingCart
(
_
,
_
,
_
,
_
,
_
,
_
,
_
)
>>
goodList
productService
.
hasRequiredProducts
(
_
,
_
,
_
,
_
)
>>
hasRequiredProducts
assortmentSdkService
.
checkShoppingCartSdk
(
_
,
_
,
_
,
_
,
_
,
_
,
_
,
_
)
>>
checkCartRequest
...
...
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