jmockit

    1热度

    2回答

    我是jmockit的新手,并且想要在基于Java的Spring应用程序配置中模拟一个bean。我想(希望更好),它会是这样的: @Configuration public class MyApplicationConfig { @Bean // this bean should be a mock SomeService getSomeService() { re

    0热度

    1回答

    当在命令行上使用gradle运行时,junit运行良好,但无法在eclipse上作为junit测试运行。为什么?? 所有的测试通过命令:命令行gradlew干净测试,但在失败时RunAs - > Junit 我正在使用jmockit作为嘲讽框架在失败的测试(只从eclipse)。还使用jmockit覆盖测试覆盖率。 这里是堆栈跟踪: Class not found app.services.sto

    1热度

    2回答

    我有一个类的私有无效方法。我想用Jmockit测试它,有没有一种方法? private void logRetry(IOException ex) { if (log.isWarnEnabled()) { log.warn("I/O exception (" + ex.getClass().getName() + ") caught when processing reque

    3热度

    1回答

    有一个java类,它基于Singleton模式。如何为这个班级做单元测试?以下是我的相关代码: public class ConfigFromFile implements ConfigStrategy { private String endpoint; private final static String CONFIG_FILE = "/conf/config.prope

    0热度

    1回答

    我有抽象类D这是测试类T的依赖关系。 测试类: public class T_Test { @Tested T tested; D dependency; public void test() { dependency.doSomething(); tested.testedMethod(dependency); } } 我

    0热度

    1回答

    我期待嘲笑支持类的静态方法,为了做到这一点,我需要嘲笑使用jMockit测试下的类的方法。在下面的例子中,我想模拟方法canContinue以便始终进入if条件。我也打算嘲笑静态方法并验证之后发生的所有事情。 public class UnitToTest { public void execute() { Foo foo = // Bar bar = //

    1热度

    1回答

    我有这样 private byte[] getInternalMDPayload(String metaDataDirString) { byte[] data = new byte[16384]; try { final InputStream internalMetadataInputStream = this.getClass().getCla

    1热度

    1回答

    我想检查函数是否被调用。我必须用jMockit来完成,其中函数的类型为void。我也想知道如何用void作为返回类型对函数进行单元测试。 我想检查下面给出的代码。我会怎么做?所有这些功能都是为了让问题变得清晰明了的假设。 如何检查函数logdata,processdata是否被调用?我怎么写测试案例为checkdata功能。 (我使用TestNG的工具。) public void checkdat

    7热度

    2回答

    假设我有一个程序,它看起来像这样: @Component public class MainAction { public void doTheAction() { System.out.println("Now doing the action"); } } @Aspect @Component public class BeforeAspect {

    4热度

    1回答

    我想使用Espresso和JMockito。 但我不运行测试。 如果你有解决办法,帮帮我。 我写了一些文件(build.gradle(app,project),Test java),如下所示。 的build.gradle(APP) apply plugin: 'com.android.application' android { compileSdkVersion 22 b