SideModel { public void swap() { myAllTools.forEach(tool -> tool.setLeft(!tool.isLeft())); myLeftVisibleTools.swap(myRightVisibleTools); notifyListeners(EventType.SWAP); } SideModel(@NotNull Project project); Project getProject(); void setContext(T context); T getContext(); void addListener(@NotNull Listener<T> listener); @NotNull List<AttachedToolWindow<T>> getAllTools(); @NotNull List<AttachedToolWindow> getVisibleTools(@NotNull Side side); @NotNull List<AttachedToolWindow> getHiddenTools(@NotNull Side side); @NotNull List<AttachedToolWindow> getTopTools(@NotNull Side side); @NotNull List<AttachedToolWindow> getBottomTools(@NotNull Side side); @Nullable AttachedToolWindow<T> getVisibleAutoHideTool(); @NotNull List<AttachedToolWindow<T>> getHiddenSliders(); @NotNull List<AttachedToolWindow<T>> getDetachedTools(); void setTools(@NotNull List<AttachedToolWindow<T>> tools); void changeToolSettingsAfterDragAndDrop(@NotNull AttachedToolWindow<T> tool,
                                                 @NotNull Side side,
                                                 @NotNull Split split,
                                                 int wantedSideToolIndex); void update(@NotNull AttachedToolWindow<T> tool, @NotNull PropertyType typeOfChange); void updateLocally(); void swap();  }
@Test public void testSwap() { mySideModel.swap(); assertThat(mySideModel.getVisibleTools(Side.RIGHT)).containsExactly(myToolWindow1, myToolWindow2).inOrder(); assertThat(mySideModel.getVisibleTools(Side.LEFT)).containsExactly(myToolWindow4); assertThat(mySideModel.getHiddenTools(Side.RIGHT)).containsExactly(myToolWindow3); assertThat(mySideModel.getHiddenTools(Side.LEFT)).containsExactly(myToolWindow5); assertThat(mySideModel.getTopTools(Side.RIGHT)).containsExactly(myToolWindow1); assertThat(mySideModel.getTopTools(Side.LEFT)).containsExactly(myToolWindow4, myToolWindow5).inOrder(); assertThat(mySideModel.getBottomTools(Side.RIGHT)).containsExactly(myToolWindow2, myToolWindow3).inOrder(); assertThat(mySideModel.getBottomTools(Side.LEFT)).isEmpty(); assertThat(mySideModel.getVisibleAutoHideTool()).isNull(); assertThat(mySideModel.getHiddenSliders()).isEmpty(); assertThat(mySideModel.getDetachedTools()).containsExactly(myFloatingToolWindow1, myFloatingToolWindow2).inOrder(); verify(myListener).modelChanged(eq(mySideModel), eq(SWAP)); }