myFixture does not have ToolWindows

已回答

Hello!

When I try to run this code:

String[] toolWindowIDs = ToolWindowManager.getInstance(myFixture.getProject()).getToolWindowIds();

the array toolWindowIDs is empty, indicating that there are no toolwindows. Is this a bug or am I missing a step?

Thank you in advance!

1

Hi,

Please share the full context. Where/When do you run this code?

1
public class MyToolWindowTest extends BasePlatformTestCase {
    public void testToolWindowExistence() {
        //Given
        createMyFixture();

        String[] toolWindowIDs = ToolWindowManager.getInstance(myFixture.getProject()).getToolWindowIds();


        //When //Then
        assertTrue(Arrays.stream(toolWindowIDs).anyMatch((id) -> id.strip().equals("MyWindow")));
    }
}

 

This is a Unit test that tests whether the tool window exists. But the problem is that there isn't a single tool window.

0

请先登录再写评论。