Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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();
}
}
}
3 changes: 3 additions & 0 deletions plugins/grand-flip-out
Original file line number Diff line number Diff line change
@@ -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.