diff --git a/runelite-client/src/test/java/net/runelite/client/ui/overlay/infobox/InfoBoxManagerTest.java b/runelite-client/src/test/java/net/runelite/client/ui/overlay/infobox/InfoBoxManagerTest.java index ee968280b7..e0ce1e6a6e 100644 --- a/runelite-client/src/test/java/net/runelite/client/ui/overlay/infobox/InfoBoxManagerTest.java +++ b/runelite-client/src/test/java/net/runelite/client/ui/overlay/infobox/InfoBoxManagerTest.java @@ -40,6 +40,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) @@ -60,16 +61,31 @@ public class InfoBoxManagerTest private static class TestInfobox extends InfoBox { - public TestInfobox(InfoBoxPriority infoBoxPriority) + private static final Plugin PLUGIN = mock(Plugin.class); + + static { - super(null, mock(Plugin.class)); + when(PLUGIN.getName()).thenReturn(""); + } + + private final String text; + + private TestInfobox(InfoBoxPriority infoBoxPriority) + { + this(infoBoxPriority, null); + } + + private TestInfobox(InfoBoxPriority infoBoxPriority, String text) + { + super(null, PLUGIN); setPriority(infoBoxPriority); + this.text = text; } @Override public String getText() { - return null; + return text; } @Override @@ -89,4 +105,14 @@ public class InfoBoxManagerTest List order = infoBoxManager.getInfoBoxes().stream().map(InfoBox::getPriority).collect(Collectors.toList()); assertEquals(Arrays.asList(InfoBoxPriority.HIGH, InfoBoxPriority.MED, InfoBoxPriority.LOW), order); } + + @Test + public void testSamePluginAndPriority() + { + infoBoxManager.addInfoBox(new TestInfobox(InfoBoxPriority.MED, "one")); + infoBoxManager.addInfoBox(new TestInfobox(InfoBoxPriority.MED, "two")); + infoBoxManager.addInfoBox(new TestInfobox(InfoBoxPriority.MED, "three")); + + assertEquals(3, infoBoxManager.getInfoBoxes().size()); + } } \ No newline at end of file