BuildScriptTreeStructureProvider implements TreeStructureProvider { @Nullable @Override public Object getData(@NotNull Collection<AbstractTreeNode<?>> selected, @NotNull String dataName) { return myRealTreeStructureProvider.getData(selected, dataName); } BuildScriptTreeStructureProvider(@NotNull TreeStructureProvider provider); @NotNull @Override Collection<AbstractTreeNode<?>> modify(@NotNull AbstractTreeNode<?> parent,
                                             @NotNull Collection<AbstractTreeNode<?>> children,
                                             @Nullable ViewSettings settings); @Nullable @Override Object getData(@NotNull Collection<AbstractTreeNode<?>> selected, @NotNull String dataName); @Override String toString();  }
@Test public void getData() { TreeStructureProvider mockProvider = mock(TreeStructureProvider.class); BuildScriptTreeStructureProvider provider = new BuildScriptTreeStructureProvider(mockProvider); Object data = "This is test data"; doReturn(data).when(mockProvider).getData(any(), any()); Object result = provider.getData(createChildren(), ""); verify(mockProvider).getData(any(), any()); assertEquals(data, result); }