Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xm-sportstest
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
xiamai-test
xm-sportstest
Commits
3278a4ad
Commit
3278a4ad
authored
Sep 24, 2024
by
xuyamei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决报错电子合同数据对比报错
parent
f33e2790
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
11 deletions
+28
-11
src/main/java/com/xiaomai/cases/polar/eleContract/TestGetValidBalanceList.java
+28
-11
No files found.
src/main/java/com/xiaomai/cases/polar/eleContract/TestGetValidBalanceList.java
View file @
3278a4ad
...
@@ -11,6 +11,8 @@ import org.testng.annotations.BeforeMethod;
...
@@ -11,6 +11,8 @@ import org.testng.annotations.BeforeMethod;
import
org.testng.annotations.Test
;
import
org.testng.annotations.Test
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
/**
* @BelongsProject: xm-sportstest
* @BelongsProject: xm-sportstest
...
@@ -32,21 +34,36 @@ public class TestGetValidBalanceList extends BaseTestImpl {
...
@@ -32,21 +34,36 @@ public class TestGetValidBalanceList extends BaseTestImpl {
}
}
@Test
@Test
public
void
testGetValidBalanceList
(){
public
void
testGetValidBalanceList
()
{
JSONObject
body
=
new
JSONObject
();
JSONObject
body
=
new
JSONObject
();
body
.
put
(
"tenantId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
body
.
put
(
"tenantId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
body
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
body
.
put
(
"brandId"
,
xmAppApi
.
getLoginInfo
().
getBrandId
());
body
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
body
.
put
(
"studioId"
,
xmAppApi
.
getLoginInfo
().
getStudioId
());
body
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
body
.
put
(
"operatorId"
,
xmAppApi
.
getLoginInfo
().
getAdminId
());
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
body
.
toString
(),
headers
).
assetsSuccess
(
true
);
xmAppApi
.
doRequest
(
RequestType
.
JSON
,
params
,
body
.
toString
(),
headers
).
assetsSuccess
(
true
);
Assert
.
assertTrue
(
xmAppApi
.
getBodyInJSON
().
getJSONArray
(
"result"
).
size
()
>
0
,
"获取租户有效余额记录失败"
);
Assert
.
assertTrue
(
xmAppApi
.
getBodyInJSON
().
getJSONArray
(
"result"
).
size
()
>
0
,
"获取租户有效余额记录失败"
);
// 和充值记录的数据对比
// 和充值记录的数据对比
String
[]
keys
=
{
"id"
,
"tenantId"
,
"productCode"
,
"purchaseAmount"
,
"startTime"
,
"endTime"
,
"payChannel"
};
String
[]
keys
=
{
"id"
,
"tenantId"
,
"productCode"
,
"purchaseAmount"
,
"startTime"
,
"endTime"
,
"payChannel"
};
for
(
int
i
=
0
;
i
<
keys
.
length
;
i
++){
Assert
.
assertEquals
(
xmAppApi
.
getBodyInJSON
().
getJSONArray
(
"result"
).
getJSONObject
(
0
).
getString
(
keys
[
i
]),
eleContractTools
.
getBalanceList
().
getJSONObject
(
0
).
getString
(
keys
[
i
]),
"获取租户有效余额记录与充值记录列表内容对比"
);
int
total
=
xmAppApi
.
getBodyInJSON
().
getJSONArray
(
"result"
).
size
();
List
<
JSONObject
>
list1
=
new
ArrayList
<>();
List
<
JSONObject
>
list2
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
total
;
i
++)
{
list1
.
add
(
eleContractTools
.
getBalanceList
().
getJSONObject
(
i
));
list2
.
add
(
xmAppApi
.
getBodyInJSON
().
getJSONArray
(
"result"
).
getJSONObject
(
i
));
}
}
}
int
flag
=
1
;
for
(
int
i
=
0
;
i
<
total
;
i
++)
{
for
(
int
j
=
0
;
j
<
keys
.
length
;
j
++)
{
String
expected
=
list1
.
get
(
i
).
getString
(
keys
[
j
]);
String
actual
=
list2
.
get
(
total
-
flag
).
getString
(
keys
[
j
]);
Assert
.
assertEquals
(
actual
,
expected
,
"获取租户有效余额记录与充值记录列表内容对比"
);
}
flag
++;
}
}
}
}
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