use of au.gov.asd.tac.constellation.views.find2.components.ReplaceTab in project constellation by constellation-app.
the class BooleanCriteriaPanelNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
findViewTopComponent = mock(FindViewTopComponent.class);
spyTopComponent = spy(findViewTopComponent);
findViewPane = mock(FindViewPane.class);
findViewTabs = mock(FindViewTabs.class);
FindViewController.getDefault();
basicFindTab = mock(BasicFindTab.class);
replaceTab = mock(ReplaceTab.class);
when(findViewTabs.getParentComponent()).thenReturn(findViewPane);
when(findViewPane.getTabs()).thenReturn(findViewTabs);
when(findViewTabs.getBasicFindTab()).thenReturn(basicFindTab);
when(findViewTabs.getReplaceTab()).thenReturn(replaceTab);
when(findViewTabs.getAdvancedFindTab()).thenReturn(advancedTab);
advancedTab = new AdvancedFindTab(findViewTabs);
}
use of au.gov.asd.tac.constellation.views.find2.components.ReplaceTab in project constellation by constellation-app.
the class FloatCriteriaPanelNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
findViewTopComponent = mock(FindViewTopComponent.class);
spyTopComponent = spy(findViewTopComponent);
findViewPane = mock(FindViewPane.class);
findViewTabs = mock(FindViewTabs.class);
FindViewController.getDefault();
basicFindTab = mock(BasicFindTab.class);
replaceTab = mock(ReplaceTab.class);
when(findViewTabs.getParentComponent()).thenReturn(findViewPane);
when(findViewPane.getTabs()).thenReturn(findViewTabs);
when(findViewTabs.getBasicFindTab()).thenReturn(basicFindTab);
when(findViewTabs.getReplaceTab()).thenReturn(replaceTab);
when(findViewTabs.getAdvancedFindTab()).thenReturn(advancedTab);
advancedTab = new AdvancedFindTab(findViewTabs);
}
use of au.gov.asd.tac.constellation.views.find2.components.ReplaceTab in project constellation by constellation-app.
the class StringCriteriaPanelNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
findViewTopComponent = mock(FindViewTopComponent.class);
spyTopComponent = spy(findViewTopComponent);
findViewPane = mock(FindViewPane.class);
findViewTabs = mock(FindViewTabs.class);
FindViewController.getDefault();
basicFindTab = mock(BasicFindTab.class);
replaceTab = mock(ReplaceTab.class);
when(findViewTabs.getParentComponent()).thenReturn(findViewPane);
when(findViewPane.getTabs()).thenReturn(findViewTabs);
when(findViewTabs.getBasicFindTab()).thenReturn(basicFindTab);
when(findViewTabs.getReplaceTab()).thenReturn(replaceTab);
when(findViewTabs.getAdvancedFindTab()).thenReturn(advancedTab);
advancedTab = new AdvancedFindTab(findViewTabs);
}
use of au.gov.asd.tac.constellation.views.find2.components.ReplaceTab in project constellation by constellation-app.
the class ColourCriteriaPanelNGTest method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
findViewTopComponent = mock(FindViewTopComponent.class);
spyTopComponent = spy(findViewTopComponent);
findViewPane = mock(FindViewPane.class);
findViewTabs = mock(FindViewTabs.class);
FindViewController.getDefault();
basicFindTab = mock(BasicFindTab.class);
replaceTab = mock(ReplaceTab.class);
when(findViewTabs.getParentComponent()).thenReturn(findViewPane);
when(findViewPane.getTabs()).thenReturn(findViewTabs);
when(findViewTabs.getBasicFindTab()).thenReturn(basicFindTab);
when(findViewTabs.getReplaceTab()).thenReturn(replaceTab);
when(findViewTabs.getAdvancedFindTab()).thenReturn(advancedTab);
advancedTab = new AdvancedFindTab(findViewTabs);
}
use of au.gov.asd.tac.constellation.views.find2.components.ReplaceTab in project constellation by constellation-app.
the class ReplaceTabNGTest method testReplaceNextAction.
/**
* Test of replaceNextAction method, of class ReplaceTab.
*/
@Test
public void testReplaceNextAction() {
System.out.println("replaceNextAction");
setupGraph();
// Create a controller mock and do nothing on retriveMatchingElements()
FindViewController mockController = mock(FindViewController.class);
mockController.init(spyTopComponent);
doNothing().when(mockController).replaceMatchingElements(Mockito.eq(false), Mockito.eq(true));
/**
* Create a basicFindMock and adds a temporary choice box and textFild
* for the functions to work.
*/
ReplaceTab replaceMock = mock(ReplaceTab.class);
final ChoiceBox<String> lookForChoiceBox = new ChoiceBox<>();
lookForChoiceBox.getItems().add("Node");
lookForChoiceBox.getSelectionModel().select(0);
final TextField findTextField = new TextField("test");
final TextField repalceTextField = new TextField("replace");
// Mock the getters to return the newly made java fx element.
when(replaceMock.getLookForChoiceBox()).thenReturn(lookForChoiceBox);
when(replaceMock.getFindTextField()).thenReturn(findTextField);
when(replaceMock.getReplaceTextField()).thenReturn(repalceTextField);
// Do nothing on saveSelected() and updateBasicFindParamters()
doCallRealMethod().when(replaceMock).replaceNextAction();
doNothing().when(replaceMock).saveSelected(Mockito.any());
doNothing().when(replaceMock).updateBasicReplaceParamters();
/**
* Create a static mock of the FindViewController. Call the
* findAllAction() then verify that saveSelected,
* updateBasicFindParameters and retrieveMatchingElements were all
* called once.
*/
try (MockedStatic<FindViewController> mockedStatic = Mockito.mockStatic(FindViewController.class)) {
mockedStatic.when(() -> FindViewController.getDefault()).thenReturn(mockController);
replaceMock.replaceNextAction();
verify(replaceMock, times(1)).saveSelected(Mockito.eq(GraphElementType.VERTEX));
verify(replaceMock, times(1)).updateBasicReplaceParamters();
verify(mockController, times(1)).replaceMatchingElements(false, true);
}
}
Aggregations