diff --git a/plugins-compat-tester/src/test/java/org/jenkins/tools/test/NonStandardTagHookTest.java b/plugins-compat-tester/src/test/java/org/jenkins/tools/test/NonStandardTagHookTest.java index 1ecc37382..ceaf5e13d 100644 --- a/plugins-compat-tester/src/test/java/org/jenkins/tools/test/NonStandardTagHookTest.java +++ b/plugins-compat-tester/src/test/java/org/jenkins/tools/test/NonStandardTagHookTest.java @@ -5,9 +5,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.powermock.api.mockito.PowerMockito.mock; -import static org.powermock.api.mockito.PowerMockito.spy; -import static org.powermock.api.mockito.PowerMockito.when; import hudson.model.UpdateSite; import java.io.File; @@ -17,9 +14,6 @@ import java.util.Map; import net.sf.json.JSONArray; import net.sf.json.JSONObject; -import org.apache.maven.scm.command.checkout.CheckOutScmResult; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.repository.ScmRepository; import org.jenkins.tools.test.hook.NonStandardTagHook; import org.jenkins.tools.test.model.MavenCoordinates; import org.jenkins.tools.test.model.PluginCompatTesterConfig; @@ -28,13 +22,8 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.core.io.ClassPathResource; -@RunWith(PowerMockRunner.class) public class NonStandardTagHookTest { @Rule @@ -86,41 +75,6 @@ public void testCheckMethodWithMinimumVersion() { } } - @Test - @PrepareForTest({SCMManagerFactory.class,NonStandardTagHook.class}) - public void testActionGeneratesProperInfo() throws Exception { - spy(SCMManagerFactory.class); - SCMManagerFactory mockFactory = mock(SCMManagerFactory.class); - ScmManager mockManager = mock(ScmManager.class); - CheckOutScmResult mockResult = mock(CheckOutScmResult.class); - when(mockResult.isSuccess()).thenReturn(Boolean.TRUE); - when(mockManager.checkOut(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(mockResult); - when(mockManager.makeScmRepository(Mockito.anyString())).thenReturn(mock(ScmRepository.class)); - when(mockFactory.createScmManager()).thenReturn(mockManager); - when(SCMManagerFactory.getInstance()).thenReturn(mockFactory); - - - Map info = new HashMap<>(); - PomData data = new PomData("artifactID", "hpi", null, null, null, null); - info.put("pomData", data); - JSONObject pluginData = new JSONObject(); - pluginData.put("name","artifactId"); - pluginData.put("version","9.9.99"); - pluginData.put("url", "example.com"); - pluginData.put("dependencies", new JSONArray()); - UpdateSite.Plugin plugin = new UpdateSite("fake", "fake").new Plugin("NO Source",pluginData); - info.put("plugin", plugin); - PluginCompatTesterConfig config = new PluginCompatTesterConfig(new File(testFolder.getRoot(), "noexists"), null, null); - info.put("config", config); - - NonStandardTagHook hook = new NonStandardTagHook(); - Map returnedConfig = hook.action(info); - assertEquals("Checkout dir is not the expected", new File(testFolder.getRoot(), "noexists/artifactID"), returnedConfig.get("checkoutDir")); - assertEquals("Checkout dir is not the same as plugin dir", returnedConfig.get("checkoutDir"), returnedConfig.get("pluginDir")); - assertEquals("RunCheckout should be false", Boolean.FALSE, returnedConfig.get("runCheckout")); - - } - @Test public void testActuallyPerformsTheCheckoutWithVersionGreaterThanMinimum() {