use of com.google.cloud.tools.libraries.json.CloudLibrary in project google-cloud-intellij by GoogleCloudPlatform.
the class GoogleCloudApiSelectorPanelTest method getPanel_withMultipleLibraries_noSelection_hasCheckboxesAndEmptyDetails.
@Test
public void getPanel_withMultipleLibraries_noSelection_hasCheckboxesAndEmptyDetails() {
CloudLibrary library1 = LIBRARY_1.toCloudLibrary();
CloudLibrary library2 = LIBRARY_2.toCloudLibrary();
// The given list should be reordered by the name's natural order, placing library1 first.
GoogleCloudApiSelectorPanel panel = new GoogleCloudApiSelectorPanel(ImmutableList.of(library2, library1), testFixture.getProject());
JTable table = panel.getCloudLibrariesTable();
assertThat(table.getSelectionModel().isSelectionEmpty()).isTrue();
TableModel model = table.getModel();
assertThat(model.getRowCount()).isEqualTo(2);
assertThat(model.getValueAt(0, 0)).isEqualTo(library1);
assertThat(model.getValueAt(1, 0)).isEqualTo(library2);
assertThat((Boolean) model.getValueAt(0, 1)).isFalse();
assertThat((Boolean) model.getValueAt(1, 1)).isFalse();
assertDetailsEmpty(panel.getDetailsPanel());
}
use of com.google.cloud.tools.libraries.json.CloudLibrary in project google-cloud-intellij by GoogleCloudPlatform.
the class GoogleCloudApiSelectorPanelTest method getApisToEnable_shouldEnableSelectedLibraryByDefault.
@Test
public void getApisToEnable_shouldEnableSelectedLibraryByDefault() {
CloudLibrary library = LIBRARY_1.toCloudLibrary();
GoogleCloudApiSelectorPanel panel = new GoogleCloudApiSelectorPanel(ImmutableList.of(library), testFixture.getProject());
JTable table = panel.getCloudLibrariesTable();
checkAddLibraryCheckbox(table, 0);
Set<CloudLibrary> apisToEnable = panel.getApisToEnable();
assertThat(apisToEnable).containsExactly(library);
}
use of com.google.cloud.tools.libraries.json.CloudLibrary in project google-cloud-intellij by GoogleCloudPlatform.
the class GoogleCloudApiSelectorPanelTest method getSelectedLibraries_withSomeSelected_returnsLibraries.
@Test
public void getSelectedLibraries_withSomeSelected_returnsLibraries() {
CloudLibrary library1 = LIBRARY_1.toCloudLibrary();
CloudLibrary library2 = LIBRARY_2.toCloudLibrary();
GoogleCloudApiSelectorPanel panel = new GoogleCloudApiSelectorPanel(ImmutableList.of(library1, library2), testFixture.getProject());
JTable table = panel.getCloudLibrariesTable();
checkAddLibraryCheckbox(table, 0);
checkAddLibraryCheckbox(table, 1);
assertThat(panel.getSelectedLibraries()).containsExactly(library1, library2);
}
use of com.google.cloud.tools.libraries.json.CloudLibrary in project google-cloud-intellij by GoogleCloudPlatform.
the class GoogleCloudApiSelectorPanelTest method getSelectedLibraries_withNoneSelected_returnsEmptySet.
@Test
public void getSelectedLibraries_withNoneSelected_returnsEmptySet() {
CloudLibrary library1 = LIBRARY_1.toCloudLibrary();
CloudLibrary library2 = LIBRARY_2.toCloudLibrary();
GoogleCloudApiSelectorPanel panel = new GoogleCloudApiSelectorPanel(ImmutableList.of(library1, library2), testFixture.getProject());
assertThat(panel.getSelectedLibraries()).isEmpty();
}
use of com.google.cloud.tools.libraries.json.CloudLibrary in project google-cloud-intellij by GoogleCloudPlatform.
the class GoogleCloudApiSelectorPanelTest method getEnableCheckbox_withNoLibrarySelected_isNotSelected.
@Test
public void getEnableCheckbox_withNoLibrarySelected_isNotSelected() {
CloudLibrary library = LIBRARY_1.toCloudLibrary();
GoogleCloudApiSelectorPanel panel = new GoogleCloudApiSelectorPanel(ImmutableList.of(library), testFixture.getProject());
Map<CloudLibrary, CloudApiManagementSpec> apiManagementMap = panel.getApiManagementMap();
panel.getDetailsPanel().setCloudLibrary(library, BOM_VERSION, apiManagementMap.get(library));
assertThat(panel.getDetailsPanel().getEnableApiCheckbox().isSelected()).isFalse();
}
Aggregations