diff --git a/package/package/src/test/java/net/runelite/pluginhub/packager/PluginTest.java b/package/package/src/test/java/net/runelite/pluginhub/packager/PluginTest.java index 3aa33c51ff22..f36a6fdfae53 100644 --- a/package/package/src/test/java/net/runelite/pluginhub/packager/PluginTest.java +++ b/package/package/src/test/java/net/runelite/pluginhub/packager/PluginTest.java @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.nio.charset.StandardCharsets; import java.util.Properties; import lombok.extern.slf4j.Slf4j; @@ -79,6 +81,28 @@ public void testExamplePluginCompiles() throws DisabledPluginException, PluginBu } } + @Test + public void testWarningIsIncludedInDisplayData() throws Throwable + { + String warning = "This plugin submits your IP address to a 3rd-party server."; + try (Plugin p = newPlugin("warning", "" + + "repository=https://github.com/runelite/example-plugin.git\n" + + "commit=0000000000000000000000000000000000000000\n" + + "warning=" + warning)) + { + try + { + assembleDisplayData(p); + Assert.fail(); + } + catch (IOException e) + { + assertContains(e.getMessage(), "chunk.properties"); + } + Assert.assertEquals(warning, p.getDisplayData().getWarning()); + } + } + @Test public void testMissingPlugin() throws DisabledPluginException, PluginBuildException, IOException, InterruptedException { @@ -220,4 +244,18 @@ private void assertContains(String haystack, String needle) { Assert.assertTrue(haystack, haystack.contains(needle)); } + + private static void assembleDisplayData(Plugin plugin) throws Throwable + { + Method method = Plugin.class.getDeclaredMethod("assembleDisplayData", boolean.class); + method.setAccessible(true); + try + { + method.invoke(plugin, true); + } + catch (InvocationTargetException e) + { + throw e.getCause(); + } + } } diff --git a/plugins/grand-flip-out b/plugins/grand-flip-out new file mode 100644 index 000000000000..d68fcc708b2a --- /dev/null +++ b/plugins/grand-flip-out @@ -0,0 +1,3 @@ +repository=https://github.com/Tunatroll/grand-flip-out.git +commit=1d2649de4cb8cdac32a771b6e6fcb9396e32fdc1 +warning=This plugin submits your IP address to a 3rd-party server not controlled or verified by RuneLite developers.