microsoft / microsoft/vscode-java-debug

Mocked objects are shown as null

未关闭
#1,361 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

ai-triaged question
主要语言
TypeScript
星标
591
派生
429
平均合并
1 天 9 小时
30 天内合并 PR
19

描述

Vscode 1.79.2
Ubuntu 20.4


@Service
public class Converters {
  private final List<String> something.

  public Converters() {
     this(new ArrayList<>();
  }

  public Optional<String> do(String v) {
  }

}

@ExtendsWith(MockitoExtention.class)
publi class VsCodeDebuggerTest
{
     @Mock
     public Converters something;

     public void shouldDoSomething() {
          when(something.do(any())).thenReturn()

          something.do("try");

          System.out.println(something); 

}
}

//with Mock.mock(something); same result,
//but with Mock.mock(something, withSettings.useConstructor(new Object[0]));
//returns non-null,
//however the mocked object in both case is functional.

I have spent quite a few time to debug the source code of the Mockito, as the null was very confusing, even if it was inside a proxy object.

Not sure, what i can expect, but while Mocking repositories, i have seen non-null objects.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,在 Ubuntu 20.4 上的 VS Code 1.79.2 中重现 issue 的 Mockito 示例里的模拟对象显示,并将默认 mock 与使用 useConstructor 创建的 mock 进行比较。该 issue 没有指出源文件或测试;完成的标准是确定预期的调试器显示效果,并确认生成的对象显示不再意外地为 null。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。