The following issues were found

litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallRoleService.java
9 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 19

              @Service
public class LitemallRoleService {
    @Resource
    private LitemallRoleMapper roleMapper;


    public Set<String> queryByIds(Integer[] roleIds) {
        Set<String> roles = new HashSet<String>();
        if(roleIds.length == 0){

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 29

                      }

        LitemallRoleExample example = new LitemallRoleExample();
        example.or().andIdIn(Arrays.asList(roleIds)).andEnabledEqualTo(true).andDeletedEqualTo(false);
        List<LitemallRole> roleList = roleMapper.selectByExample(example);

        for(LitemallRole role : roleList){
            roles.add(role.getName());
        }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 29

                      }

        LitemallRoleExample example = new LitemallRoleExample();
        example.or().andIdIn(Arrays.asList(roleIds)).andEnabledEqualTo(true).andDeletedEqualTo(false);
        List<LitemallRole> roleList = roleMapper.selectByExample(example);

        for(LitemallRole role : roleList){
            roles.add(role.getName());
        }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 29

                      }

        LitemallRoleExample example = new LitemallRoleExample();
        example.or().andIdIn(Arrays.asList(roleIds)).andEnabledEqualTo(true).andDeletedEqualTo(false);
        List<LitemallRole> roleList = roleMapper.selectByExample(example);

        for(LitemallRole role : roleList){
            roles.add(role.getName());
        }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 47

                      if (!StringUtils.isEmpty(name)) {
            criteria.andNameLike("%" + name + "%");
        }
        criteria.andDeletedEqualTo(false);

        if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
            example.setOrderByClause(sort + " " + order);
        }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 78

              
    public boolean checkExist(String name) {
        LitemallRoleExample example = new LitemallRoleExample();
        example.or().andNameEqualTo(name).andDeletedEqualTo(false);
        return roleMapper.countByExample(example) != 0;
    }

    public List<LitemallRole> queryAll() {
        LitemallRoleExample example = new LitemallRoleExample();

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 78

              
    public boolean checkExist(String name) {
        LitemallRoleExample example = new LitemallRoleExample();
        example.or().andNameEqualTo(name).andDeletedEqualTo(false);
        return roleMapper.countByExample(example) != 0;
    }

    public List<LitemallRole> queryAll() {
        LitemallRoleExample example = new LitemallRoleExample();

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 84

              
    public List<LitemallRole> queryAll() {
        LitemallRoleExample example = new LitemallRoleExample();
        example.or().andDeletedEqualTo(false);
        return roleMapper.selectByExample(example);
    }
}

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 22

                  private LitemallRoleMapper roleMapper;


    public Set<String> queryByIds(Integer[] roleIds) {
        Set<String> roles = new HashSet<String>();
        if(roleIds.length == 0){
            return roles;
        }


            

Reported by PMD.

litemall-core/src/main/java/org/linlinjava/litemall/core/task/Task.java
9 issues
Private field 'id' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 10

              import java.util.concurrent.TimeUnit;

public abstract class Task implements Delayed, Runnable{
    private String id = "";
    private long start = 0;

    public Task(String id, long delayInMilliseconds){
        this.id = id;
        this.start = System.currentTimeMillis() + delayInMilliseconds;

            

Reported by PMD.

The field initializer for 'id' is never used (overwritten on line 14)
Design

Line: 10

              import java.util.concurrent.TimeUnit;

public abstract class Task implements Delayed, Runnable{
    private String id = "";
    private long start = 0;

    public Task(String id, long delayInMilliseconds){
        this.id = id;
        this.start = System.currentTimeMillis() + delayInMilliseconds;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 10

              import java.util.concurrent.TimeUnit;

public abstract class Task implements Delayed, Runnable{
    private String id = "";
    private long start = 0;

    public Task(String id, long delayInMilliseconds){
        this.id = id;
        this.start = System.currentTimeMillis() + delayInMilliseconds;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 11

              
public abstract class Task implements Delayed, Runnable{
    private String id = "";
    private long start = 0;

    public Task(String id, long delayInMilliseconds){
        this.id = id;
        this.start = System.currentTimeMillis() + delayInMilliseconds;
    }

            

Reported by PMD.

Private field 'start' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 11

              
public abstract class Task implements Delayed, Runnable{
    private String id = "";
    private long start = 0;

    public Task(String id, long delayInMilliseconds){
        this.id = id;
        this.start = System.currentTimeMillis() + delayInMilliseconds;
    }

            

Reported by PMD.

The field initializer for 'start' is never used (overwritten on line 15)
Design

Line: 11

              
public abstract class Task implements Delayed, Runnable{
    private String id = "";
    private long start = 0;

    public Task(String id, long delayInMilliseconds){
        this.id = id;
        this.start = System.currentTimeMillis() + delayInMilliseconds;
    }

            

Reported by PMD.

Avoid using redundant field initializer for 'start'
Performance

Line: 11

              
public abstract class Task implements Delayed, Runnable{
    private String id = "";
    private long start = 0;

    public Task(String id, long delayInMilliseconds){
        this.id = id;
        this.start = System.currentTimeMillis() + delayInMilliseconds;
    }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 41

                          return false;
        }
        Task t = (Task)o;
        return this.id.equals(t.getId());
    }

    @Override
    public int hashCode() {
        return this.id.hashCode();

            

Reported by PMD.

Avoid unused imports such as 'java.time.LocalDateTime'
Design

Line: 5

              
import com.google.common.primitives.Ints;

import java.time.LocalDateTime;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;

public abstract class Task implements Delayed, Runnable{
    private String id = "";

            

Reported by PMD.

litemall-core/src/main/java/org/linlinjava/litemall/core/util/SystemInfoPrinter.java
9 issues
Logger calls should be surrounded by log level guards.
Design

Line: 44

                  private static void printHeader(String title) {
        logger.info(getLineCopper());
        logger.info("");
        logger.info("              " + title);
        logger.info("");
    }

    private static void printEnd() {
        logger.info("  ");

            

Reported by PMD.

Logger calls should be surrounded by log level guards.
Design

Line: 68

              
        if (head.startsWith(CREATE_PART_COPPER)) {
            logger.info("");
            logger.info("    [[  " + line + "  ]]");
            logger.info("");
        } else {
            logger.info("    " + head + "        ->        " + line);
        }
    }

            

Reported by PMD.

Logger calls should be surrounded by log level guards.
Design

Line: 71

                          logger.info("    [[  " + line + "  ]]");
            logger.info("");
        } else {
            logger.info("    " + head + "        ->        " + line);
        }
    }
}

            

Reported by PMD.

All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 8

              
import java.util.Map;

public class SystemInfoPrinter {

    private static final Log logger = LogFactory.getLog(SystemInfoPrinter.class);
    public static final String CREATE_PART_COPPER = "XOXOXOXOX";

    private static int maxSize = 0;

            

Reported by PMD.

Logger should be defined private static final and have the correct class
Error

Line: 10

              
public class SystemInfoPrinter {

    private static final Log logger = LogFactory.getLog(SystemInfoPrinter.class);
    public static final String CREATE_PART_COPPER = "XOXOXOXOX";

    private static int maxSize = 0;

    public static void printInfo(String title, Map<String, String> infos) {

            

Reported by PMD.

Avoid using redundant field initializer for 'maxSize'
Performance

Line: 13

                  private static final Log logger = LogFactory.getLog(SystemInfoPrinter.class);
    public static final String CREATE_PART_COPPER = "XOXOXOXOX";

    private static int maxSize = 0;

    public static void printInfo(String title, Map<String, String> infos) {
        setMaxSize(infos);

        printHeader(title);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 32

                          if (entry.getValue() == null)
                continue;

            int size = entry.getKey().length() + entry.getValue().length();

            if (size > maxSize)
                maxSize = size;
        }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 32

                          if (entry.getValue() == null)
                continue;

            int size = entry.getKey().length() + entry.getValue().length();

            if (size > maxSize)
                maxSize = size;
        }


            

Reported by PMD.

Avoid appending characters as strings in StringBuffer.append.
Performance

Line: 56

                  private static String getLineCopper() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < maxSize; i++) {
            sb.append("=");
        }

        return sb.toString();
    }


            

Reported by PMD.

litemall-db/src/main/java/org/linlinjava/litemall/db/util/OrderHandleOption.java
9 issues
The class 'OrderHandleOption' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=16, WMC=16)
Design

Line: 3

              package org.linlinjava.litemall.db.util;

public class OrderHandleOption {
    private boolean cancel = false;      // 取消操作
    private boolean delete = false;      // 删除操作
    private boolean pay = false;         // 支付操作
    private boolean comment = false;    // 评论操作
    private boolean confirm = false;    // 确认收货操作
    private boolean refund = false;     // 取消订单并退款操作

            

Reported by PMD.

Avoid using redundant field initializer for 'cancel'
Performance

Line: 4

              package org.linlinjava.litemall.db.util;

public class OrderHandleOption {
    private boolean cancel = false;      // 取消操作
    private boolean delete = false;      // 删除操作
    private boolean pay = false;         // 支付操作
    private boolean comment = false;    // 评论操作
    private boolean confirm = false;    // 确认收货操作
    private boolean refund = false;     // 取消订单并退款操作

            

Reported by PMD.

Avoid using redundant field initializer for 'delete'
Performance

Line: 5

              
public class OrderHandleOption {
    private boolean cancel = false;      // 取消操作
    private boolean delete = false;      // 删除操作
    private boolean pay = false;         // 支付操作
    private boolean comment = false;    // 评论操作
    private boolean confirm = false;    // 确认收货操作
    private boolean refund = false;     // 取消订单并退款操作
    private boolean rebuy = false;        // 再次购买

            

Reported by PMD.

Avoid using redundant field initializer for 'pay'
Performance

Line: 6

              public class OrderHandleOption {
    private boolean cancel = false;      // 取消操作
    private boolean delete = false;      // 删除操作
    private boolean pay = false;         // 支付操作
    private boolean comment = false;    // 评论操作
    private boolean confirm = false;    // 确认收货操作
    private boolean refund = false;     // 取消订单并退款操作
    private boolean rebuy = false;        // 再次购买
    private boolean aftersale = false;        // 售后操作

            

Reported by PMD.

Avoid using redundant field initializer for 'comment'
Performance

Line: 7

                  private boolean cancel = false;      // 取消操作
    private boolean delete = false;      // 删除操作
    private boolean pay = false;         // 支付操作
    private boolean comment = false;    // 评论操作
    private boolean confirm = false;    // 确认收货操作
    private boolean refund = false;     // 取消订单并退款操作
    private boolean rebuy = false;        // 再次购买
    private boolean aftersale = false;        // 售后操作


            

Reported by PMD.

Avoid using redundant field initializer for 'confirm'
Performance

Line: 8

                  private boolean delete = false;      // 删除操作
    private boolean pay = false;         // 支付操作
    private boolean comment = false;    // 评论操作
    private boolean confirm = false;    // 确认收货操作
    private boolean refund = false;     // 取消订单并退款操作
    private boolean rebuy = false;        // 再次购买
    private boolean aftersale = false;        // 售后操作

    public boolean isCancel() {

            

Reported by PMD.

Avoid using redundant field initializer for 'refund'
Performance

Line: 9

                  private boolean pay = false;         // 支付操作
    private boolean comment = false;    // 评论操作
    private boolean confirm = false;    // 确认收货操作
    private boolean refund = false;     // 取消订单并退款操作
    private boolean rebuy = false;        // 再次购买
    private boolean aftersale = false;        // 售后操作

    public boolean isCancel() {
        return cancel;

            

Reported by PMD.

Avoid using redundant field initializer for 'rebuy'
Performance

Line: 10

                  private boolean comment = false;    // 评论操作
    private boolean confirm = false;    // 确认收货操作
    private boolean refund = false;     // 取消订单并退款操作
    private boolean rebuy = false;        // 再次购买
    private boolean aftersale = false;        // 售后操作

    public boolean isCancel() {
        return cancel;
    }

            

Reported by PMD.

Avoid using redundant field initializer for 'aftersale'
Performance

Line: 11

                  private boolean confirm = false;    // 确认收货操作
    private boolean refund = false;     // 取消订单并退款操作
    private boolean rebuy = false;        // 再次购买
    private boolean aftersale = false;        // 售后操作

    public boolean isCancel() {
        return cancel;
    }


            

Reported by PMD.

litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/CaptchaCodeManager.java
9 issues
All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 13

              /**
 * 缓存系统中的验证码
 */
public class CaptchaCodeManager {
    private static ConcurrentHashMap<String, CaptchaItem> captchaCodeCache = new ConcurrentHashMap<>();

    /**
     * 添加到缓存
     *

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 27

              
        //已经发过验证码且验证码还未过期
        if (captchaCodeCache.get(phoneNumber) != null) {
            if (captchaCodeCache.get(phoneNumber).getExpireTime().isAfter(LocalDateTime.now())) {
                return false;
            } else {
                //存在但是已过期,删掉
                captchaCodeCache.remove(phoneNumber);
            }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 27

              
        //已经发过验证码且验证码还未过期
        if (captchaCodeCache.get(phoneNumber) != null) {
            if (captchaCodeCache.get(phoneNumber).getExpireTime().isAfter(LocalDateTime.now())) {
                return false;
            } else {
                //存在但是已过期,删掉
                captchaCodeCache.remove(phoneNumber);
            }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 39

                      captchaItem.setPhoneNumber(phoneNumber);
        captchaItem.setCode(code);
        // 有效期为1分钟
        captchaItem.setExpireTime(LocalDateTime.now().plusMinutes(1));

        captchaCodeCache.put(phoneNumber, captchaItem);

        return true;
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 58

                          return null;

        //有电话记录但是已经过期
        if (captchaCodeCache.get(phoneNumber).getExpireTime().isBefore(LocalDateTime.now())) {
            return null;
        }

        return captchaCodeCache.get(phoneNumber).getCode();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 58

                          return null;

        //有电话记录但是已经过期
        if (captchaCodeCache.get(phoneNumber).getExpireTime().isBefore(LocalDateTime.now())) {
            return null;
        }

        return captchaCodeCache.get(phoneNumber).getCode();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 62

                          return null;
        }

        return captchaCodeCache.get(phoneNumber).getCode();
    }
}

            

Reported by PMD.

Avoid unused imports such as 'java.util.HashMap'
Design

Line: 6

              import org.linlinjava.litemall.wx.dto.CaptchaItem;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 缓存系统中的验证码

            

Reported by PMD.

Avoid unused imports such as 'java.util.Map'
Design

Line: 7

              
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 缓存系统中的验证码
 */

            

Reported by PMD.

litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminCouponController.java
8 issues
Logger should be defined private static final and have the correct class
Error

Line: 27

              @RequestMapping("/admin/coupon")
@Validated
public class AdminCouponController {
    private final Log logger = LogFactory.getLog(AdminCouponController.class);

    @Autowired
    private LitemallCouponService couponService;
    @Autowired
    private LitemallCouponUserService couponUserService;

            

Reported by PMD.

Avoid unused private fields such as 'logger'.
Design

Line: 27

              @RequestMapping("/admin/coupon")
@Validated
public class AdminCouponController {
    private final Log logger = LogFactory.getLog(AdminCouponController.class);

    @Autowired
    private LitemallCouponService couponService;
    @Autowired
    private LitemallCouponUserService couponUserService;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 30

                  private final Log logger = LogFactory.getLog(AdminCouponController.class);

    @Autowired
    private LitemallCouponService couponService;
    @Autowired
    private LitemallCouponUserService couponUserService;

    @RequiresPermissions("admin:coupon:list")
    @RequiresPermissionsDesc(menu = {"推广管理", "优惠券管理"}, button = "查询")

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 32

                  @Autowired
    private LitemallCouponService couponService;
    @Autowired
    private LitemallCouponUserService couponUserService;

    @RequiresPermissions("admin:coupon:list")
    @RequiresPermissionsDesc(menu = {"推广管理", "优惠券管理"}, button = "查询")
    @GetMapping("/list")
    public Object list(String name, Short type, Short status,

            

Reported by PMD.

The String literal '优惠券管理' appears 6 times in this file; the first occurrence is on line 35
Error

Line: 35

                  private LitemallCouponUserService couponUserService;

    @RequiresPermissions("admin:coupon:list")
    @RequiresPermissionsDesc(menu = {"推广管理", "优惠券管理"}, button = "查询")
    @GetMapping("/list")
    public Object list(String name, Short type, Short status,
                       @RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer limit,
                       @Sort @RequestParam(defaultValue = "add_time") String sort,

            

Reported by PMD.

The String literal '推广管理' appears 6 times in this file; the first occurrence is on line 35
Error

Line: 35

                  private LitemallCouponUserService couponUserService;

    @RequiresPermissions("admin:coupon:list")
    @RequiresPermissionsDesc(menu = {"推广管理", "优惠券管理"}, button = "查询")
    @GetMapping("/list")
    public Object list(String name, Short type, Short status,
                       @RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer limit,
                       @Sort @RequestParam(defaultValue = "add_time") String sort,

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 77

                      }

        // 如果是兑换码类型,则这里需要生存一个兑换码
        if (coupon.getType().equals(CouponConstant.TYPE_CODE)) {
            String code = couponService.generateCode();
            coupon.setCode(code);
        }

        couponService.add(coupon);

            

Reported by PMD.

Avoid unused imports such as 'org.springframework.web.bind.annotation'
Design

Line: 18

              import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;

@RestController

            

Reported by PMD.

litemall-core/src/test/java/org/linlinjava/litemall/core/SmsTest.java
8 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 37

              public class SmsTest {

    @Autowired
    private NotifyService notifyService;

    @Test
    public void testCaptcha() {
        String phone = "xxxxxxxxxxx";
        String[] params = new String[]{"123456"};

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 40

                  private NotifyService notifyService;

    @Test
    public void testCaptcha() {
        String phone = "xxxxxxxxxxx";
        String[] params = new String[]{"123456"};

        notifyService.notifySmsTemplate(phone, NotifyType.CAPTCHA, params);
    }

            

Reported by PMD.

The String literal 'xxxxxxxxxxx' appears 4 times in this file; the first occurrence is on line 41
Error

Line: 41

              
    @Test
    public void testCaptcha() {
        String phone = "xxxxxxxxxxx";
        String[] params = new String[]{"123456"};

        notifyService.notifySmsTemplate(phone, NotifyType.CAPTCHA, params);
    }


            

Reported by PMD.

The String literal '123456' appears 4 times in this file; the first occurrence is on line 42
Error

Line: 42

                  @Test
    public void testCaptcha() {
        String phone = "xxxxxxxxxxx";
        String[] params = new String[]{"123456"};

        notifyService.notifySmsTemplate(phone, NotifyType.CAPTCHA, params);
    }

    @Test

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 48

                  }

    @Test
    public void testPaySucceed() {
        String phone = "xxxxxxxxxxx";
        String[] params = new String[]{"123456"};

        notifyService.notifySmsTemplate(phone, NotifyType.PAY_SUCCEED, params);
    }

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 56

                  }

    @Test
    public void testShip() {
        String phone = "xxxxxxxxxxx";
        String[] params = new String[]{"123456"};

        notifyService.notifySmsTemplate(phone, NotifyType.SHIP, params);
    }

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 64

                  }

    @Test
    public void testRefund() {
        String phone = "xxxxxxxxxxx";
        String[] params = new String[]{"123456"};

        notifyService.notifySmsTemplate(phone, NotifyType.REFUND, params);
    }

            

Reported by PMD.

Avoid unused imports such as 'org.springframework.test.context.junit4.SpringJUnit4ClassRunner'
Design

Line: 14

              import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.core.task.SyncTaskExecutor;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.concurrent.Executor;


            

Reported by PMD.

litemall-db/src/test/java/org/linlinjava/litemall/db/StatMapperTest.java
8 issues
System.out.println is used
Design

Line: 27

                  public void testUser() {
        List<Map> result = statMapper.statUser();
        for (Map m : result) {
            m.forEach((k, v) -> System.out.println("key:value = " + k + ":" + v));
        }
    }

    @Test
    public void testOrder() {

            

Reported by PMD.

System.out.println is used
Design

Line: 35

                  public void testOrder() {
        List<Map> result = statMapper.statOrder();
        for (Map m : result) {
            m.forEach((k, v) -> System.out.println("key:value = " + k + ":" + v));
        }
    }

    @Test
    public void testGoods() {

            

Reported by PMD.

System.out.println is used
Design

Line: 43

                  public void testGoods() {
        List<Map> result = statMapper.statGoods();
        for (Map m : result) {
            m.forEach((k, v) -> System.out.println("key:value = " + k + ":" + v));
        }
    }

}

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 21

              public class StatMapperTest {

    @Autowired
    private StatMapper statMapper;

    @Test
    public void testUser() {
        List<Map> result = statMapper.statUser();
        for (Map m : result) {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 24

                  private StatMapper statMapper;

    @Test
    public void testUser() {
        List<Map> result = statMapper.statUser();
        for (Map m : result) {
            m.forEach((k, v) -> System.out.println("key:value = " + k + ":" + v));
        }
    }

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 32

                  }

    @Test
    public void testOrder() {
        List<Map> result = statMapper.statOrder();
        for (Map m : result) {
            m.forEach((k, v) -> System.out.println("key:value = " + k + ":" + v));
        }
    }

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 40

                  }

    @Test
    public void testGoods() {
        List<Map> result = statMapper.statGoods();
        for (Map m : result) {
            m.forEach((k, v) -> System.out.println("key:value = " + k + ":" + v));
        }
    }

            

Reported by PMD.

Avoid unused imports such as 'org.springframework.test.context.junit4.SpringJUnit4ClassRunner'
Design

Line: 8

              import org.linlinjava.litemall.db.dao.StatMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.List;
import java.util.Map;

            

Reported by PMD.

litemall-all/src/test/java/org/linlinjava/litemall/allinone/AllinoneConfigTest.java
8 issues
System.out.println is used
Design

Line: 21

                  @Test
    public void test() {
        // 测试获取application-core.yml配置信息
        System.out.println(environment.getProperty("litemall.express.appId"));
        // 测试获取application-db.yml配置信息
        System.out.println(environment.getProperty("spring.datasource.druid.url"));
        // 测试获取application-wx.yml配置信息
        System.out.println(environment.getProperty("litemall.wx.app-id"));
        // 测试获取application-admin.yml配置信息

            

Reported by PMD.

System.out.println is used
Design

Line: 23

                      // 测试获取application-core.yml配置信息
        System.out.println(environment.getProperty("litemall.express.appId"));
        // 测试获取application-db.yml配置信息
        System.out.println(environment.getProperty("spring.datasource.druid.url"));
        // 测试获取application-wx.yml配置信息
        System.out.println(environment.getProperty("litemall.wx.app-id"));
        // 测试获取application-admin.yml配置信息
//        System.out.println(environment.getProperty(""));
        // 测试获取application.yml配置信息

            

Reported by PMD.

System.out.println is used
Design

Line: 25

                      // 测试获取application-db.yml配置信息
        System.out.println(environment.getProperty("spring.datasource.druid.url"));
        // 测试获取application-wx.yml配置信息
        System.out.println(environment.getProperty("litemall.wx.app-id"));
        // 测试获取application-admin.yml配置信息
//        System.out.println(environment.getProperty(""));
        // 测试获取application.yml配置信息
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.wx"));
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.admin"));

            

Reported by PMD.

System.out.println is used
Design

Line: 29

                      // 测试获取application-admin.yml配置信息
//        System.out.println(environment.getProperty(""));
        // 测试获取application.yml配置信息
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.wx"));
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.admin"));
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall"));
    }

}

            

Reported by PMD.

System.out.println is used
Design

Line: 30

              //        System.out.println(environment.getProperty(""));
        // 测试获取application.yml配置信息
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.wx"));
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.admin"));
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall"));
    }

}

            

Reported by PMD.

System.out.println is used
Design

Line: 31

                      // 测试获取application.yml配置信息
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.wx"));
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall.admin"));
        System.out.println(environment.getProperty("logging.level.org.linlinjava.litemall"));
    }

}

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 16

              @SpringBootTest
public class AllinoneConfigTest {
    @Autowired
    private Environment environment;

    @Test
    public void test() {
        // 测试获取application-core.yml配置信息
        System.out.println(environment.getProperty("litemall.express.appId"));

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 19

                  private Environment environment;

    @Test
    public void test() {
        // 测试获取application-core.yml配置信息
        System.out.println(environment.getProperty("litemall.express.appId"));
        // 测试获取application-db.yml配置信息
        System.out.println(environment.getProperty("spring.datasource.druid.url"));
        // 测试获取application-wx.yml配置信息

            

Reported by PMD.

litemall-core/src/test/java/org/linlinjava/litemall/core/IntegerTest.java
8 issues
Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 8

              public class IntegerTest {
    @Test
    public void test() {
        Integer a = new Integer(512);
        int b = 512;
        Integer c = new Integer(512);
        System.out.println(a==b);
        System.out.println(a.equals(b));
        System.out.println(a == c);

            

Reported by PMD.

Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 10

                  public void test() {
        Integer a = new Integer(512);
        int b = 512;
        Integer c = new Integer(512);
        System.out.println(a==b);
        System.out.println(a.equals(b));
        System.out.println(a == c);
        System.out.println(a.equals(c));
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 11

                      Integer a = new Integer(512);
        int b = 512;
        Integer c = new Integer(512);
        System.out.println(a==b);
        System.out.println(a.equals(b));
        System.out.println(a == c);
        System.out.println(a.equals(c));
    }
}

            

Reported by PMD.

System.out.println is used
Design

Line: 12

                      int b = 512;
        Integer c = new Integer(512);
        System.out.println(a==b);
        System.out.println(a.equals(b));
        System.out.println(a == c);
        System.out.println(a.equals(c));
    }
}

            

Reported by PMD.

System.out.println is used
Design

Line: 13

                      Integer c = new Integer(512);
        System.out.println(a==b);
        System.out.println(a.equals(b));
        System.out.println(a == c);
        System.out.println(a.equals(c));
    }
}

            

Reported by PMD.

System.out.println is used
Design

Line: 14

                      System.out.println(a==b);
        System.out.println(a.equals(b));
        System.out.println(a == c);
        System.out.println(a.equals(c));
    }
}

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 7

              
public class IntegerTest {
    @Test
    public void test() {
        Integer a = new Integer(512);
        int b = 512;
        Integer c = new Integer(512);
        System.out.println(a==b);
        System.out.println(a.equals(b));

            

Reported by PMD.

Use equals() to compare object references.
Error

Line: 13

                      Integer c = new Integer(512);
        System.out.println(a==b);
        System.out.println(a.equals(b));
        System.out.println(a == c);
        System.out.println(a.equals(c));
    }
}

            

Reported by PMD.