| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- package com.td.boss;
- import cn.hutool.json.JSONUtil;
- import com.td.boss.common.pojo.Result;
- import com.td.boss.game.comconfigland.service.ComConfigLandService;
- import com.td.boss.game.comconfigland.vo.ComConfigLandVo;
- import com.td.boss.game.commallfood.controller.ComMallFoodController;
- import com.td.boss.game.commallfood.vo.ComMallFoodSimpleVo;
- import com.td.boss.game.commallseed.controller.ComMallSeedController;
- import com.td.boss.game.commallseed.vo.ComMallSeedVo;
- import com.td.boss.game.complayercultivate.controller.ComPlayerCultivateController;
- import com.td.boss.game.complayercultivate.pojo.ComPlayerCultivate;
- import com.td.boss.game.complayercultivate.serivce.ComPlayerCultivateSerivce;
- import com.td.boss.game.complayerdog.controller.ComPlayerDogController;
- import com.td.boss.game.complayergoods.controller.ComPlayerGoodsController;
- import com.td.boss.game.complayerland.controller.ComPlayerLandController;
- import com.td.boss.game.complayerland.vo.ComPlayerLandAndPlantVo;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.boot.test.context.SpringBootTest;
- import org.springframework.test.context.junit4.SpringRunner;
- import java.util.List;
- import java.util.Map;
- @RunWith(SpringRunner.class)
- @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
- public class ComPlayerCultivateTests {
- private String userId = "1002";
- private int configlandid = 25;
- @Autowired
- private ComPlayerLandController comPlayerLandController;
- @Autowired
- private ComMallSeedController comMallSeedController;
- @Autowired
- private ComPlayerGoodsController comPlayerGoodsController;
- @Autowired
- private ComConfigLandService comConfigLandService;
- @Autowired
- private ComPlayerCultivateController comPlayerCultivateController;
- @Autowired
- private ComPlayerCultivateSerivce comPlayerCultivateSerivce;
- //需要测试 多天上线以后情况
- //解锁某个土地 【新增功能】【测试完】
- @Test
- public void buyLand() {
- Result<?> comPlayerLandAndPlantVoResult = comPlayerCultivateController.payLand(userId, 26);
- print(comPlayerLandAndPlantVoResult);
- }
- //种种子选择放养数量 【修改完毕】【测试完】
- @Test
- public void plantFunction() {
- //测试重复种植
- // print(comPlayerLandController.plantFunction(userId, configlandid, 11, 1000));
- //测试种植数量大于土地最大承受
- // print(comPlayerLandController.plantFunction(userId, 26, 11, 1000));
- //测试种植 包里没有的种子
- // print(comPlayerLandController.plantFunction(userId, 26, 11, 20));
- //测试种子数量不足
- // print(comPlayerLandController.plantFunction(userId, 26, 10, 20));
- print(comPlayerLandController.plantFunction(userId, 26, 10, 2));
- }
- //喂养就是购买粮食 【修改完毕】【测试完】
- @Test
- public void buyFood() {
- //需要计算一下 有多少只动物。要喂多少天。就算一下一共花多少钱。还得插一个喂养明细。
- // print( comPlayerDogController.addFoodFunction(userId,6,1));
- // print( comPlayerCultivateSerivce.buyFood(userId, configlandid));
- // print( comPlayerCultivateSerivce.buyFood(userId, 26));
- print(comPlayerCultivateSerivce.buyFood(userId, 26));
- }
- //获取某个人所有土地 【修改完毕】【测试完】,需要查询喂养记录,重新计算成熟日期
- @Test
- public void getLandByUserId() {
- Result<List<ComPlayerLandAndPlantVo>> landFunction = comPlayerLandController.getLandFunction(userId, null);
- print(landFunction);
- }
- //偷果实 【修改完毕 待测试】
- @Test
- public void stealFruitFunction() {
- comPlayerGoodsController.stealFruitFunction(userId, userId, configlandid);
- }
- //收货,成熟 【修改完毕 测试完】,一天不喂延长2天
- @Test
- public void addFruitFunction() {
- comPlayerGoodsController.addFruitFunction(userId, 26);
- }
- //获取所有土地 【一点没变】【测试完】
- @Test
- public void getLands() {
- Result<List<ComConfigLandVo>> list = comConfigLandService.list(new ComConfigLandVo());
- print(list);
- }
- //获取所有种子列表 【一点没变】【测试完】
- @Test
- public void getSeed() {
- Result<List<ComMallSeedVo>> snbFunction = comMallSeedController.getSNBFunction(userId);
- print(snbFunction);
- }
- //购买种子【一点没变】【测试完】这块逻辑是只要钱够,种子id对就没问题
- @Test
- public void buySeeds() {
- comMallSeedController.snbBuySeedsFunction(userId, 200, 10);
- }
- //购买种子,进入仓库【一点没变】【测试完】
- @Test
- public void getGood() {
- Result<Map> seedAndFruitFunction = comPlayerGoodsController.getSeedAndFruitFunction(userId);
- print(seedAndFruitFunction);
- }
- private void print(Result result) {
- System.out.println(JSONUtil.toJsonStr(result.getData()));
- }
- }
|