[bug 396928] test destination button is disabled when configurator
provides no tester
diff --git a/bundles/org.eclipse.platform.discovery.destprefs/src/org/eclipse/platform/discovery/destprefs/internal/prefpage/ui/DestinationConfiguratorsPresenter.java b/bundles/org.eclipse.platform.discovery.destprefs/src/org/eclipse/platform/discovery/destprefs/internal/prefpage/ui/DestinationConfiguratorsPresenter.java
index 32dc6b2..e51ad4e 100644
--- a/bundles/org.eclipse.platform.discovery.destprefs/src/org/eclipse/platform/discovery/destprefs/internal/prefpage/ui/DestinationConfiguratorsPresenter.java
+++ b/bundles/org.eclipse.platform.discovery.destprefs/src/org/eclipse/platform/discovery/destprefs/internal/prefpage/ui/DestinationConfiguratorsPresenter.java
@@ -1,13 +1,3 @@
-/*******************************************************************************

- * Copyright (c) 2012 SAP AG and others.

- * All rights reserved. This program and the accompanying materials

- * are made available under the terms of the Eclipse Public License v1.0

- * which accompanies this distribution, and is available at

- * http://www.eclipse.org/legal/epl-v10.html

- *

- * Contributors:

- *     SAP AG - initial API and implementation

- *******************************************************************************/

 package org.eclipse.platform.discovery.destprefs.internal.prefpage.ui;

 

 import java.util.ArrayList;

@@ -92,7 +82,7 @@
 			view.setAddEnabled(true);

 			view.setEditEnabled(true);

 			view.setRemoveEnabled(true);

-			view.setTestEnabled(true);

+			view.setTestEnabled(getConfigDescription(destinationProviderId).createConfigurator().getSearchDestinationTester()!=null);

 		}

 	}

 

diff --git a/tests/org.eclipse.platform.discovery.destprefs.test.unit/src/org/eclipse/platform/discovery/destprefs/test/unit/prefpage/DestinationConfiguratorsPresenterTest.java b/tests/org.eclipse.platform.discovery.destprefs.test.unit/src/org/eclipse/platform/discovery/destprefs/test/unit/prefpage/DestinationConfiguratorsPresenterTest.java
index 3c487a9..ac06d8a 100644
--- a/tests/org.eclipse.platform.discovery.destprefs.test.unit/src/org/eclipse/platform/discovery/destprefs/test/unit/prefpage/DestinationConfiguratorsPresenterTest.java
+++ b/tests/org.eclipse.platform.discovery.destprefs.test.unit/src/org/eclipse/platform/discovery/destprefs/test/unit/prefpage/DestinationConfiguratorsPresenterTest.java
@@ -1,13 +1,3 @@
-/*******************************************************************************

- * Copyright (c) 2012 SAP AG and others.

- * All rights reserved. This program and the accompanying materials

- * are made available under the terms of the Eclipse Public License v1.0

- * which accompanies this distribution, and is available at

- * http://www.eclipse.org/legal/epl-v10.html

- *

- * Contributors:

- *     SAP AG - initial API and implementation

- *******************************************************************************/

 package org.eclipse.platform.discovery.destprefs.test.unit.prefpage;

 

 import java.util.ArrayList;

@@ -104,7 +94,9 @@
 		Mockito.verify(view).setAddEnabled(Mockito.eq(true));

 		Mockito.verify(view).setEditEnabled(Mockito.eq(true));

 		Mockito.verify(view).setRemoveEnabled(Mockito.eq(true));

-		Mockito.verify(view).setAddEnabled(Mockito.eq(true));

+		

+		//test is disabled if get

+		Mockito.verify(view).setTestEnabled(Mockito.eq(false));

 	}

 	

 	@Test

@@ -151,6 +143,18 @@
 	}

 	

 	@Test

+	public void testEnablementWhenHasTester() {

+		presenter.selectionChanged(new DestinationConfiguratorSelection(fixture.DEST_PROVIDER_CAT1_1, null));

+		@SuppressWarnings("unchecked")

+		ISearchDestinationTester<ISearchDestination> tester = Mockito.mock(ISearchDestinationTester.class);

+		Mockito.when(fixture.configurator_1_1.getSearchDestinationTester()).thenReturn(tester);

+		presenter.selectionChanged(new DestinationConfiguratorSelection(fixture.DEST_PROVIDER_CAT1_1, fixture.destination1));

+

+		Mockito.verify(view).setTestEnabled(Mockito.eq(true));

+

+	}

+	

+	@Test

 	public void edit() {

 		presenter.selectionChanged(new DestinationConfiguratorSelection(fixture.DEST_PROVIDER_CAT1_1, fixture.destination1));