alibaba / testable-mock

换种思路写Mock,让单元测试更简单
https://alibaba.github.io/testable-mock/
MIT License
1.83k stars 310 forks source link

fixed static instance reference issue #251

Closed zcbbpo closed 2 years ago

zcbbpo commented 2 years ago
public class StaticInstanceReference {

    private static A a = new A();

    public void staticMethodReference() {
        //consumesRun(() -> a.doIt());
        consumesRun(a::doIt);
        //A b = new A();
        //consumesRun(b::doIt);
    }

    private void consumesRun(Runnable r) {
        r.run();
    }

   public static class A {
        public void doIt() {

        }
   }
}

修复类似这种静态实例的方法引用

zcbbpo commented 2 years ago

是否还存在其他场景的方法引用呢

iceqing commented 2 years ago

https://github.com/alibaba/testable-mock/issues/250

linfan commented 2 years ago

目前没发现其他未覆盖的场景

linfan commented 2 years ago

已发布 v0.7.2 包含此PR