use of space.arim.libertybans.bootstrap.CulpritFinder in project LibertyBans by A248.
the class VelocityCulpritFinderTest method findCulprit.
@Test
public void findCulprit(@Mock ProxyServer server, @Mock PluginManager pluginManager, @Mock PluginContainer pluginString, @Mock PluginContainer pluginOwnClass) {
class OwnClass {
}
{
when(server.getPluginManager()).thenReturn(pluginManager);
when(pluginManager.getPlugins()).thenReturn(List.of(pluginString, pluginOwnClass));
when(pluginString.getInstance()).thenAnswer((i) -> Optional.of("a".concat("b")));
setDescription(pluginString, "JDK", "0");
when(pluginOwnClass.getInstance()).thenAnswer((i) -> Optional.of(new OwnClass()));
setDescription(pluginOwnClass, "Self", "1");
}
CulpritFinder culpritFinder = new VelocityCulpritFinder(server);
assertEquals("JDK 0", culpritFinder.findCulprit(List.class));
assertEquals("Self 1", culpritFinder.findCulprit(getClass()));
}
Aggregations