@Test public void testOnAddContainerPopupCanceled() { List<ContainerConfig> currentElements = new ArrayList<>(); when(dataProvider.getList()).thenReturn(currentElements); int originalSize = currentElements.size(); //the add container popup is called prepareAndCallPopup(); //the popup was canceled. cancelCommandCaptor.getValue().execute(); //no elements were added to the list. assertEquals(originalSize, currentElements.size()); verify(configParamsChangeEvent, never()).fire(any()); verify(contentChangeHandler, never()).onContentChange(); }
@Test public void testOnAddContainerPopupCanceled() { List<ContainerConfig> currentElements = new ArrayList<>(); when(dataProvider.getList()).thenReturn(currentElements); int originalSize = currentElements.size(); //the add container popup is called prepareAndCallPopup(); //the popup was canceled. cancelCommandCaptor.getValue().execute(); //no elements were added to the list. assertEquals(originalSize, currentElements.size()); verify(configParamsChangeEvent, never()).fire(any()); verify(contentChangeHandler, never()).onContentChange(); }
@Test public void testOnAddContainerPopupConfirmed() { List<ContainerConfig> currentElements = new ArrayList<>(); when(dataProvider.getList()).thenReturn(currentElements); //the add container popup is called prepareAndCallPopup(); ContainerConfig returnedConfig = new ContainerConfig(CONTAINER_NAME_VALUE, GROUP_ID_VALUE, ARTIFACT_ID_VALUE, VERSION_VALUE); //the popup was properly completed with a ContainerConfig. okCommandCaptor.getValue().execute(returnedConfig); //the container config was added to the list. assertTrue(currentElements.contains(returnedConfig)); verify(configParamsChangeEvent, times(1)).fire(new ContainerConfigParamsChangeEvent(currentElements)); verify(contentChangeHandler, times(1)).onContentChange(); }
@Test public void testOnAddContainerPopupConfirmed() { List<ContainerConfig> currentElements = new ArrayList<>(); when(dataProvider.getList()).thenReturn(currentElements); //the add container popup is called prepareAndCallPopup(); ContainerConfig returnedConfig = new ContainerConfig(CONTAINER_NAME_VALUE, GROUP_ID_VALUE, ARTIFACT_ID_VALUE, VERSION_VALUE); //the popup was properly completed with a ContainerConfig. okCommandCaptor.getValue().execute(returnedConfig); //the container config was added to the list. assertTrue(currentElements.contains(returnedConfig)); verify(configParamsChangeEvent, times(1)).fire(new ContainerConfigParamsChangeEvent(currentElements)); verify(contentChangeHandler, times(1)).onContentChange(); }