java - 需要一个实例化类的方法被调用

假设我有以下代码:

public class MyClass {
    public void doSomething(int value) {

    }
}
public class MyNewClass {
    public static void main(String args[]) {
        MyClass myClass = new MyClass();
    }
}

是否有可能出现编译器错误,即尚未在doSomething(int)中调用MyClass中的MyNewClass?实际上,我知道您会将该方法放入构造函数中,但是出于好奇,这个问题仍然存在。

最佳答案

您可以最接近地使用代码覆盖率工具。为您提供全套的单元测试,它们将使您能够识别例如从未调用过的方法。我不能特别推荐一个库,但是有很多可用的库。

https://stackoverflow.com/questions/18213925/

相关文章:

c++ - KEIL错误: no instance of overloaded function “

java - 无法解析为类型-在RHEL 5上编译servlet(tomcat)时出错

compiler-errors - 错误在Centos6.4中更新lib.so.6文件

android - 使用二进制文字数字时出错。为什么要使用旧的JDK?

compiler-errors - php我的管理员无法启动并显示警报消息

c++ - 生成文件错误

wpf - 当应用程序类型为类库时,未定义的CLR namespace

compiler-errors - 使用 Eclipse Android 编译 FFMPEG

c++ - Googletest 编译错误 : ‘xyzTest’ was not declared

ubuntu - 无法在Ubuntu 13.04中安装ARToolkit