From a4cd57b6a24e2b6e38c48a9624d306500db7359f Mon Sep 17 00:00:00 2001
From: Robert Scott <code@humanleg.org.uk>
Date: Sat, 24 Feb 2018 11:48:11 +0000
Subject: [PATCH v2 19/28] tests: add PluginHandlerJOSMTooOldTest

this test is a good example which exercises ExtendedDialogMocker and
HelpAwareOptionPaneMocker. also consolidate dummy plugins together in
__files/ directory
---
 test/data/__files/plugin/baz_plugin.v6.jar         | Bin 0 -> 2890 bytes
 test/data/__files/plugin/baz_plugin.v7.jar         | Bin 0 -> 2999 bytes
 test/data/__files/plugin/dummy_plugin.v31701.jar   | Bin 0 -> 3130 bytes
 .../{dummy_plugin.jar => dummy_plugin.v31772.jar}  | Bin
 test/data/plugin/dummy_plugin.jar                  | Bin 3043 -> 0 bytes
 .../downloadtasks/PluginDownloadTaskTest.java      |   4 +-
 .../preferences/plugin/PluginPreferenceTest.java   |   2 +-
 .../josm/plugins/PluginHandlerJOSMTooOldTest.java  | 276 +++++++++++++++++++++
 8 files changed, 279 insertions(+), 3 deletions(-)
 create mode 100644 test/data/__files/plugin/baz_plugin.v6.jar
 create mode 100644 test/data/__files/plugin/baz_plugin.v7.jar
 create mode 100644 test/data/__files/plugin/dummy_plugin.v31701.jar
 rename test/data/__files/plugin/{dummy_plugin.jar => dummy_plugin.v31772.jar} (100%)
 delete mode 100644 test/data/plugin/dummy_plugin.jar
 create mode 100644 test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java

diff --git a/test/data/__files/plugin/baz_plugin.v6.jar b/test/data/__files/plugin/baz_plugin.v6.jar
new file mode 100644
index 0000000000000000000000000000000000000000..5e4210de44b2646bbc56ea847ce3dbc507e191e7
GIT binary patch
literal 2890
zcmWIWW@Zs#;Nak3$Ss`f!+-=h8CV#6T|*poJ^kGD|D9rBU}gyLX6FE@V1g<Oz^PdT
zr~<Cp*U`_@%{4eg&)3a2z}Ek;fxunmr}h;s2jc@9AL#0G3yI1KXj>gJHB{O5v^el~
zeE;Pz&B;&8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zOyFX`UHc(S=mI(yUKirl1gZ@YU_C+;tZu}u6;wMSz%6vGu(}cvTA<nzxljSsmI%NN
z3`D4dA$CIyfYzPJ9!Jl8sA2vO$b}S02&bd#02N6Hpuh^zfnGr2)(<M85Fh}nerSP(
z+YnHZg#fL%4M7xOxD5jpVF+-Duwjq_4G}q@AVN;&pdt+cn1QVmP@tj)5!j0`*MST~
XE8qgWSwXED1|A^P24)>jaHALig%OZ+

literal 0
HcmV?d00001

diff --git a/test/data/__files/plugin/baz_plugin.v7.jar b/test/data/__files/plugin/baz_plugin.v7.jar
new file mode 100644
index 0000000000000000000000000000000000000000..e00bd97b820bfbc096eff5ab30b3b32cc98e1d02
GIT binary patch
literal 2999
zcmWIWW@h1HVBlb22xgz}&42_r8CV#6T|*poJ^kGD|D9rB2mmS-Vc_84VBp>7<%6V>
zK?KNwEA@5s^K^3!4$<><^9?xdci2E+kNYY69~|uaFMVmu&)umIc#-*0*R&13yq&p~
zu_3>{TI6!hxn^x`y?Gw5#cpS>Kdj1;?|CjeO+9+)uk$p<S+<*co<5vAW9rdu)?2Q9
ztX`saYl5E6HtQW}73CgBK5*2&n9yo$sx5cv-f<u6@NF`#ZnJ-KthH7!I&(biM?+tb
zi;peK$A>G$#a)H+3xu>Sa@Vt6zuTU6VUz6^k4w+mQbOfdNAZ1maBJcY#@GAm_KJJG
zEc}#lcX{IPDNK@@>*WP|->c5)f3DE(ToI<zUFzcT<6QWC=MwIPaiwc_&f7G5IfpM_
z!rSBzf^7+T|0kWcZVUA~zjNIW7klm0W!%PrNnzosfnxRn-s~JPl|7D}j0_AjfEW~%
zkWddo3w3s2P-f;Prl%I`<5t9rP?VXRpNCJWFuGDBlL{jfB(wd|9KZt9kYALJM}-hn
zMSekQUU5lLYHCStVgVlY;#k#Z<rnAT(Ik&sQ$bE?dM1je(fy!ISaVWh71(x2g2omL
zKAz65e!;HApTCC}6!8RcaFl-fSQ5sN6uv(pTn`w7>>RHD@@IiO2f~QVfo_%*P!<}a
zk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c8UAfytKAp&AB&Gz&sK1al1fi_cgOnsoa*<9
z@7~q_W!ummDxbP%WfI?KQIncIN3Hqa+tws#)CWb~WN!QW^?-_^IrGZk*&dn6h7YEz
z_5M^i<+L=oZr1JO+Pp~-5ve8Bk9!uDWc-@6P)<X4e_CO<+I<)EMIOcmwt{mzT`cQm
zbZ&A_HG1=BeONfp&vZkXsX4-afst)@pMO7L;2i1R+40oSca_VMwoT^?KAo>T?DKK5
z;S$@xNtYKUEvkEGxW<=7sbkvp<c|A>k(VaBpXxOEYVq^j(j7vk6)P%!L>y)kv(>q}
zp+~gs?Q;(gU*9D%&WEQynRr3*{hcLY$9P;PN4AAc*spQeUwCP5dxp!KCx5+X9F(@u
zS2}d9>I3`Ir3D^MiJbZ`f_H^76boO9RDIv@hw0|0XV?5U-2QWS`Q`JA?H0yeVoP(6
zT=6jUT+lI*S4SL$6ROU9Z7u3bS$#h+L#%$mmnrM~Ql%~LKGOI&ab1^MTF0@wahK1U
z-aK`2Ge0O5+>E&YYZ<T_3ugwU0!Ah-2HZ^uPzpi-cq;+YpkQPY0X80BO$y{164azX
z0Bs->t`(_)fowT?xeKaE5ugm{TzI{Ta51_jP|b<}vk{tL^(=0!pqdr|j-hLX)w>7-
z&~pu_=0$+-Km#E4Fm4^7niv5jfq4=$*C7WHx{aWU3jsW_>W9|TxE%qisS%(Kw;`~s
zkIzM*ni~Oj6E+M|k0a6%C_<6zWz<yg2WTL)UI)1XmiR!LkV`gDm5l%%z*LUA0!KCn
o6u!uL15^$ofHkl-$BZ9BrDA|LE2tH~zzc*4K$kcIo9YY<00j=C$p8QV

literal 0
HcmV?d00001

diff --git a/test/data/__files/plugin/dummy_plugin.v31701.jar b/test/data/__files/plugin/dummy_plugin.v31701.jar
new file mode 100644
index 0000000000000000000000000000000000000000..530f5fc107b7869d3b437c76bb8eb53ba2ebd301
GIT binary patch
literal 3130
zcmWIWW@Zs#;Nak3aLbwN!+-=h8CV#6T|*poJ^kGD|D9rBU}gyLX6FE@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_|$EM4NLCu
zxL@W@-H;c$X7?gZVbRw3Tg`U$&njokNVS;h6w>{B(acZoPU=5Qg<n_ZBusu-@amC7
z*}qU>=VjAscG*7MD((H-=}W~M*JP%Z(os8%mb}&|TY5#9bMB4LEg3zEi~;*M_DarL
znqqkCOK!^Z6U7;uc&xgse>-m|m-z0S5;w7S;S9#^H%dk+r(4!9XwZ5VtbbIYzjexH
zkM&%d#fC?9YneguXJ9a6do-~AI}D7&0B=Sn5eC#246JzqYQdlac#{Owo<Y}&T(yGQ
zF9=`@WWu!~wPrvja4}%7%0N{x0_*`g7g`}B+zTq!k!wy+m5c!QVOpRSG(O8v{TT!d
z07yNH+j*dx76D42I#AO(J{v(bF9IyVsvlYp<8}n7CPsjpxDA12ID9TrLYM?(i7^wC
zd-0hEs;Lnmj41P<^)_l0BNsQIni~OT6K^PvdK}~dSn>xYC*-UFD!`Bcu&^VuI1BJ*
RWdj++1B59+Cm#TJ0szu62Ic?&

literal 0
HcmV?d00001

diff --git a/test/data/__files/plugin/dummy_plugin.jar b/test/data/__files/plugin/dummy_plugin.v31772.jar
similarity index 100%
rename from test/data/__files/plugin/dummy_plugin.jar
rename to test/data/__files/plugin/dummy_plugin.v31772.jar
diff --git a/test/data/plugin/dummy_plugin.jar b/test/data/plugin/dummy_plugin.jar
deleted file mode 100644
index 0a1f4086917323129dc8fda92a29389be0d053ff..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 3043
zcmb7Gc|6ql8z1Km#x@M%r`*Xsj`gEL&S4B@NIAn`7<OjN8VtsfNE@-Obv0s<DMyY%
zuBDK>(b(iF6-m;mytW)K_B$liM!V1J_4$7OdEW2m^L?Jr^LalQ6c;x?2m}U!cz%(!
z0)1k9Aa0PYg`<f&(hdP%=>>r>A6&s8ZopLlzY?a;0Rl|`O9X&@bhS0HLn15=IcnG<
zj$%yEZJOfE@X^>Ap&if0WbNqT*E#Iv<BI1Vo`@psE=#`}Z~(G;U%O4yBQpFIt@2ef
zk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b1U
zwe_e06b&#a=!FS;|2R#o4;~xPua6#V0NaY<RDthD=qH27cEQ<_x^C>?8Nem_Ag~)j
z|Ea=kiQR<M1CVvW-5SA`+)c#T2gK*k{&t6COYkP1AGqaP-0<y4*pj?Sa&T*s4ei;E
zOm2f~t!7c*CR-Eituw@y>~&+8;g5gC_d&onNWU)O8?;4n99*9Z`sVMgBfnJUO{6b?
s+#=x{x%!4qe;Mn`2WvA{1Mh!|_3874LGb`!_T&Nqv5y=8jP)SU-wCz|b^rhX

diff --git a/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java b/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java
index 39de9a2b3..f9e3a0668 100644
--- a/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java
+++ b/test/unit/org/openstreetmap/josm/actions/downloadtasks/PluginDownloadTaskTest.java
@@ -55,7 +55,7 @@ public class PluginDownloadTaskTest extends AbstractDownloadTaskTestParent {
      */
     @Test
     public void testUpdatePluginValid() throws Exception {
-        this.pluginPath = "plugin/dummy_plugin.jar";
+        this.pluginPath = "plugin/dummy_plugin.v31772.jar";
         this.mockHttp();
 
         final File srcPluginFile = new File(
@@ -73,7 +73,7 @@ public class PluginDownloadTaskTest extends AbstractDownloadTaskTestParent {
         }
 
         // get PluginInformation from jar file
-        final PluginInformation pluginInformation = new PluginInformation(srcPluginFile);
+        final PluginInformation pluginInformation = new PluginInformation(srcPluginFile, "dummy_plugin");
         // ...and grafting on the downloadlink
         pluginInformation.downloadlink = this.getRemoteFileUrl();
 
diff --git a/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java b/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
index 7c89cd081..dc2c05575 100644
--- a/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
+++ b/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java
@@ -50,7 +50,7 @@ public class PluginPreferenceTest {
      */
     public static PluginInformation getDummyPluginInformation() throws PluginException {
         return new PluginInformation(
-                new File(TestUtils.getTestDataRoot() + "plugin/dummy_plugin.jar"), "dummy_plugin");
+                new File(TestUtils.getTestDataRoot() + "__files/plugin/dummy_plugin.v31772.jar"), "dummy_plugin");
     }
 
     /**
diff --git a/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java b/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java
new file mode 100644
index 000000000..66499ec93
--- /dev/null
+++ b/test/unit/org/openstreetmap/josm/plugins/PluginHandlerJOSMTooOldTest.java
@@ -0,0 +1,276 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.plugins;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.spi.preferences.Config;
+import org.openstreetmap.josm.testutils.ExtendedDialogMocker;
+import org.openstreetmap.josm.testutils.HelpAwareOptionPaneMocker;
+import org.openstreetmap.josm.testutils.JOSMTestRules;
+import org.openstreetmap.josm.testutils.PluginServer;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+import com.github.tomakehurst.wiremock.client.WireMock;
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+
+/**
+ * Test parts of {@link PluginHandler} class when the reported JOSM version is too old for the plugin.
+ */
+public class PluginHandlerJOSMTooOldTest {
+    /**
+     * Setup test.
+     */
+    @Rule
+    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    public JOSMTestRules test = new JOSMTestRules().preferences().main().assumeRevision(
+        "Revision: 6000\n"
+    );
+
+    /**
+     * Plugin server mock.
+     */
+    @Rule
+    public WireMockRule pluginServerRule = new WireMockRule(
+        options().dynamicPort().usingFilesUnderDirectory(TestUtils.getTestDataRoot())
+    );
+
+    @Before
+    public void setUp() throws Exception {
+        Config.getPref().putInt("pluginmanager.version", 999);
+        Config.getPref().put("pluginmanager.lastupdate", "999");
+        Config.getPref().putList("pluginmanager.sites",
+            ImmutableList.of(String.format("http://localhost:%s/plugins", this.pluginServerRule.port()))
+        );
+
+        this.referenceDummyJarOld = new File(TestUtils.getTestDataRoot(), "__files/plugin/dummy_plugin.v31701.jar");
+        this.referenceDummyJarNew = new File(TestUtils.getTestDataRoot(), "__files/plugin/dummy_plugin.v31772.jar");
+        this.referenceBazJarOld = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v6.jar");
+        this.referenceBazJarNew = new File(TestUtils.getTestDataRoot(), "__files/plugin/baz_plugin.v7.jar");
+        this.pluginDir = Main.pref.getPluginsDirectory();
+        this.targetDummyJar = new File(this.pluginDir, "dummy_plugin.jar");
+        this.targetDummyJarNew = new File(this.pluginDir, "dummy_plugin.jar.new");
+        this.targetBazJar = new File(this.pluginDir, "baz_plugin.jar");
+        this.targetBazJarNew = new File(this.pluginDir, "baz_plugin.jar.new");
+        this.pluginDir.mkdirs();
+    }
+
+    private File pluginDir;
+    private File referenceDummyJarOld;
+    private File referenceDummyJarNew;
+    private File referenceBazJarOld;
+    private File referenceBazJarNew;
+    private File targetDummyJar;
+    private File targetDummyJarNew;
+    private File targetBazJar;
+    private File targetBazJarNew;
+
+    private final String bazPluginVersionReqString = "JOSM version 8,001 required for plugin baz_plugin.";
+    private final String dummyPluginVersionReqString = "JOSM version 7,001 required for plugin dummy_plugin.";
+    private final String dummyPluginFailedString = "<html>Updating the following plugin has failed:<ul><li>dummy_plugin</li></ul>"
+        + "Please open the Preference Dialog after JOSM has started and try to update it manually.</html>";
+
+    /**
+     * test update of plugins when those plugins turn out to require a higher JOSM version, but the
+     * user chooses to update them anyway.
+     */
+    @Test
+    public void testUpdatePluginsDownloadBoth() throws Exception {
+        final PluginServer pluginServer = new PluginServer(
+            new PluginServer.RemotePlugin(this.referenceDummyJarNew),
+            new PluginServer.RemotePlugin(this.referenceBazJarNew)
+        );
+        pluginServer.applyToWireMockServer(this.pluginServerRule);
+        Config.getPref().putList("plugins", ImmutableList.of("dummy_plugin", "baz_plugin"));
+
+        final ExtendedDialogMocker edMocker = new ExtendedDialogMocker(ImmutableMap.<String, Object>builder()
+            .put(this.bazPluginVersionReqString, "Download Plugin")
+            .put(this.dummyPluginVersionReqString, "Download Plugin")
+            .build()
+        );
+
+        Files.copy(this.referenceDummyJarOld.toPath(), this.targetDummyJar.toPath());
+        Files.copy(this.referenceBazJarOld.toPath(), this.targetBazJar.toPath());
+
+        final List<PluginInformation> updatedPlugins = PluginHandler.updatePlugins(
+            Main.parent,
+            null,
+            null,
+            false
+        ).stream().sorted((a, b) -> a.name.compareTo(b.name)).collect(ImmutableList.toImmutableList());
+
+        assertEquals(
+            ImmutableList.of(
+                this.dummyPluginVersionReqString,
+                this.bazPluginVersionReqString
+            ),
+            edMocker.getInvocationLog().stream().map(
+                invocationEntry -> invocationEntry[1]
+            ).sorted().collect(ImmutableList.toImmutableList())
+        );
+
+        assertEquals(2, updatedPlugins.size());
+
+        assertEquals(updatedPlugins.get(0).name, "baz_plugin");
+        assertEquals("7", updatedPlugins.get(0).localversion);
+
+        assertEquals(updatedPlugins.get(1).name, "dummy_plugin");
+        assertEquals("31772", updatedPlugins.get(1).localversion);
+
+        assertFalse(targetDummyJarNew.exists());
+        assertFalse(targetBazJarNew.exists());
+
+        TestUtils.assertFileContentsEqual(this.referenceDummyJarNew, this.targetDummyJar);
+        TestUtils.assertFileContentsEqual(this.referenceBazJarNew, this.targetBazJar);
+
+        this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugins")));
+        this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/dummy_plugin.v31772.jar")));
+        this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/baz_plugin.v7.jar")));
+
+        assertEquals(Config.getPref().getInt("pluginmanager.version", 111), 6000);
+        // not mocking the time so just check it's not its original value
+        assertNotEquals(Config.getPref().get("pluginmanager.lastupdate", "999"), "999");
+    }
+
+    /**
+     * test update of plugins when those plugins turn out to require a higher JOSM version, but the
+     * user chooses to update one and skip the other.
+     */
+    @Test
+    public void testUpdatePluginsSkipOne() throws Exception {
+        final PluginServer pluginServer = new PluginServer(
+            new PluginServer.RemotePlugin(this.referenceDummyJarNew),
+            new PluginServer.RemotePlugin(this.referenceBazJarNew)
+        );
+        pluginServer.applyToWireMockServer(this.pluginServerRule);
+        Config.getPref().putList("plugins", ImmutableList.of("dummy_plugin", "baz_plugin"));
+
+        final ExtendedDialogMocker edMocker = new ExtendedDialogMocker(ImmutableMap.<String, Object>builder()
+            .put(this.bazPluginVersionReqString, "Download Plugin")
+            .put(this.dummyPluginVersionReqString, "Skip Download")
+            .build()
+        );
+        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(ImmutableMap.<String, Object>builder()
+            .put(this.dummyPluginFailedString, "OK")
+            .build()
+        );
+
+        Files.copy(this.referenceDummyJarOld.toPath(), this.targetDummyJar.toPath());
+        Files.copy(this.referenceBazJarOld.toPath(), this.targetBazJar.toPath());
+
+        final List<PluginInformation> updatedPlugins = PluginHandler.updatePlugins(
+            Main.parent,
+            null,
+            null,
+            false
+        ).stream().sorted((a, b) -> a.name.compareTo(b.name)).collect(ImmutableList.toImmutableList());
+
+        assertEquals(
+            ImmutableList.of(
+                this.dummyPluginVersionReqString,
+                this.bazPluginVersionReqString
+            ),
+            edMocker.getInvocationLog().stream().map(
+                invocationEntry -> invocationEntry[1]
+            ).sorted().collect(ImmutableList.toImmutableList())
+        );
+
+        assertEquals(
+            ImmutableList.of(
+                this.dummyPluginFailedString
+            ),
+            haMocker.getInvocationLog().stream().map(
+                invocationEntry -> invocationEntry[1]
+            ).sorted().collect(ImmutableList.toImmutableList())
+        );
+
+        assertEquals(2, updatedPlugins.size());
+
+        assertEquals(updatedPlugins.get(0).name, "baz_plugin");
+        assertEquals("7", updatedPlugins.get(0).localversion);
+
+        assertEquals(updatedPlugins.get(1).name, "dummy_plugin");
+        assertEquals("31701", updatedPlugins.get(1).localversion);
+
+        assertFalse(targetDummyJarNew.exists());
+        assertFalse(targetBazJarNew.exists());
+
+        TestUtils.assertFileContentsEqual(this.referenceDummyJarOld, this.targetDummyJar);
+        TestUtils.assertFileContentsEqual(this.referenceBazJarNew, this.targetBazJar);
+
+        this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugins")));
+        this.pluginServerRule.verify(0, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/dummy_plugin.v31772.jar")));
+        this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/baz_plugin.v7.jar")));
+
+        // shouldn't have been updated
+        assertEquals(Config.getPref().getInt("pluginmanager.version", 111), 999);
+        assertEquals(Config.getPref().get("pluginmanager.lastupdate", "999"), "999");
+    }
+
+    /**
+     * When the plugin list suggests that the jar file at the provided URL *doesn't* require a newer JOSM
+     * but in fact the plugin served *does*, it is installed anyway.
+     *
+     * This is probably NOT desirable and should be fixed, however this test documents the behaviour.
+     */
+    @Test
+    public void testUpdatePluginsUnexpectedlyJOSMTooOld() throws Exception {
+        final PluginServer pluginServer = new PluginServer(
+            new PluginServer.RemotePlugin(this.referenceDummyJarNew),
+            new PluginServer.RemotePlugin(this.referenceBazJarNew, ImmutableMap.of(
+                "Plugin-Mainversion", "5500"
+            ))
+        );
+        pluginServer.applyToWireMockServer(this.pluginServerRule);
+        Config.getPref().putList("plugins", ImmutableList.of("baz_plugin"));
+
+        // setting up blank ExtendedDialogMocker which would raise an exception if any attempt to show
+        // and ExtendedDialog were made
+        new ExtendedDialogMocker();
+
+        Files.copy(this.referenceBazJarOld.toPath(), this.targetBazJar.toPath());
+
+        final List<PluginInformation> updatedPlugins = ImmutableList.copyOf(PluginHandler.updatePlugins(
+            Main.parent,
+            null,
+            null,
+            false
+        ));
+
+        // questionably correct
+        assertEquals(1, updatedPlugins.size());
+
+        // questionably correct
+        assertEquals(updatedPlugins.get(0).name, "baz_plugin");
+        assertEquals("7", updatedPlugins.get(0).localversion);
+
+        assertFalse(targetBazJarNew.exists());
+
+        // questionably correct
+        TestUtils.assertFileContentsEqual(this.referenceBazJarNew, this.targetBazJar);
+
+        this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugins")));
+        // questionably correct
+        this.pluginServerRule.verify(1, WireMock.getRequestedFor(WireMock.urlEqualTo("/plugin/baz_plugin.v7.jar")));
+
+        // should have been updated
+        assertEquals(Config.getPref().getInt("pluginmanager.version", 111), 6000);
+        assertNotEquals(Config.getPref().get("pluginmanager.lastupdate", "999"), "999");
+    }
+}
-- 
2.11.0

