java私有单元测试没有覆盖

时间:2019-05-25 14:59:41

标签: java unit-testing

我正在尝试测试私有方法,但是无法覆盖完整的代码,并陷入了方法的困境。这是我尝试测试违规观察者的方法,但它没有验证并且没有覆盖所有#assigning 6 cores for the calculations no_cores <- detectCores() - 2 # Initiate cluster cl <- makeCluster(no_cores) result<-parLapply(cl, values_for_a, fun = my_function, b = 1, c = 2, d = 3, e = 4, f = 5, g = 6, h = 7) stopCluster(cl) 的整个范围:

code

这是单元测试:

private ViolationObserver.ViolationListener mViolationListener = new ViolationObserver.ViolationListener() {
    public void onActivation(ViolationObserver source, boolean active) {
        boolean activeBefore = mSpeedAlertActive && mGeoFenceActive;

        if (source == mSpeedAlertObserver) {
            mSpeedAlertActive = active;
        } else if (source == mGeoFenceObserver) {
            mGeoFenceActive = active;
        }

        boolean activeNow = mSpeedAlertActive && mGeoFenceActive;

        if (!activeBefore && activeNow) {
            mMonitoringStateReporter.publishMonitoringState(true);
        } else if (activeBefore && !activeNow) {
            mMonitoringStateReporter.publishMonitoringState(false)

0 个答案:

没有答案