Commit 2755c53f by xuyamei

解决报错

parent 4162e588
......@@ -44,9 +44,19 @@ public class TestGetCoachHistorySpecialDate extends BaseTestImpl {
JSONObject pageStudioPersonalCoach = reserveTools.pageStudioPersonalCoach("");
int total = pageStudioPersonalCoach.getInteger("total");
Random rand = new Random();
// 随机取个教练
// 随机取1个教练
coachedId = pageStudioPersonalCoach.getJSONArray("records").getJSONObject(rand.nextInt(total>10?10:total)).getString("id");
// 获取教练后先清除特殊日期数据。避免重叠
// 查询特殊可约时间列表
JSONArray specialTimeVOS = reserveTools.getCoachHistorySpecialDate(coachedId);
for (int i = 0; i < specialTimeVOS.size(); i++){
String id = specialTimeVOS.getJSONObject(i).getJSONArray("recordIds").getString(0);
// 删除查询到的特殊可约时间
reserveTools.deleteSpecialDate(id);
}
Long date = TimeUtils.getBeforeDayDate(1);
JSONObject body = new JSONObject();
body.put("brandId", xmAppApi.getLoginInfo().getBrandId());
......@@ -65,7 +75,7 @@ public class TestGetCoachHistorySpecialDate extends BaseTestImpl {
reserveTools.createSpecialDate(coachedId,"OFF_DUTY",specialTimeInfoRequest);
// 设置全天休息完成后检查个人时间是否有这条数据
JSONArray specialTimeVOS = reserveTools.getCoachHistorySpecialDate(coachedId);
specialTimeVOS = reserveTools.getCoachHistorySpecialDate(coachedId);
boolean flag = false;
for (int i = 0; i < specialTimeVOS.size(); i++){
JSONObject specialTimeVO = specialTimeVOS.getJSONObject(i);
......@@ -77,8 +87,23 @@ public class TestGetCoachHistorySpecialDate extends BaseTestImpl {
Assert.assertTrue(flag,"设置特殊日期全天休息后在历史特定日期可约时间列表没有找到相关数据");
}
@Test(description = "删除特殊日期",priority = 1)
public void testDeleteSpecialDate() {
// 查询特殊可约时间列表
JSONArray specialTimeVOS = reserveTools.getCoachHistorySpecialDate(coachedId);
for (int i = 0; i < specialTimeVOS.size(); i++){
String id = specialTimeVOS.getJSONObject(i).getJSONArray("recordIds").getString(0);
// 删除查询到的特殊可约时间
reserveTools.deleteSpecialDate(id);
}
@Test(description = "设置特定日期可约",priority = 1)
specialTimeVOS = reserveTools.getCoachHistorySpecialDate(coachedId);
Assert.assertEquals(specialTimeVOS.size(),0,"删除特殊日期后,特殊日期列表不为空");
}
@Test(description = "设置特定日期可约",priority = 2)
public void testCreateSpecialDate_ON() {
Long date = TimeUtils.getBeforeDayDate(2);
......@@ -123,8 +148,8 @@ public class TestGetCoachHistorySpecialDate extends BaseTestImpl {
Assert.assertTrue(flag,"设置特殊日期在历史特定日期可约时间列表没有找到相关数据");
}
@Test(description = "删除特殊日期",priority = 2)
public void testDeleteSpecialDate() {
@Test(description = "删除特殊日期",priority = 3)
public void testDeleteSpecialDate2() {
// 查询特殊可约时间列表
JSONArray specialTimeVOS = reserveTools.getCoachHistorySpecialDate(coachedId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment