microsoft / microsoft/vscode-java-debug

Mocked objects are shown as null

Open
#1,361 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triaged question
Dominant language
TypeScript
Stars
591
Forks
429
Avg merge
1d 9h
Merged PRs (30d)
19

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the mocked-object display from the issue's Mockito example in VS Code 1.79.2 on Ubuntu 20.4, comparing the default mock with one created using useConstructor. The issue names no source file or test; done would require establishing the intended debugger rendering and confirming the resulting object display is no longer unexpectedly null.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.