Authored by Lixiaodi

增加测试数据类

... ... @@ -11,6 +11,7 @@ import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.common.cache.Cachable;
import com.yohoufo.product.controller.test.ExampleResultFactory;
@Controller
public class ProductController {
... ... @@ -28,10 +29,8 @@ public class ProductController {
@RequestParam(value = "current_vip_level", required = false, defaultValue = "0") Integer currentVipLevel,
@RequestParam(value = "image_url", required = false) String imageUrl) {
if (null == productskn && null == productId) {
return new ApiResponse(404, "product_skn or product_id Is Null", null);
}
logger.info("queryProductDetailBySKN method=app.product.data productskn is:{},productId is:{}", productskn, productId);
return new ApiResponse.ApiResponseBuilder().data(null).code(200).message("product info").build();
return new ApiResponse.ApiResponseBuilder().data(ExampleResultFactory.createData()).code(200).message("product info").build();
}
}
\ No newline at end of file
... ...
package com.yohoufo.product.controller.test;
public class ExampleResultFactory {
public static Object createData() {
String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
switch (methodName) {
case "queryProductDetailBySKN":
return 1;
default:
return null;
}
}
}
... ...