use of com.alessiodp.parties.common.parties.ColorManager in project Parties by AlessioDP.
the class MigrationsTest method setUp.
@BeforeAll
public static void setUp(@TempDir Path tempDir) {
LoggerManager mockLoggerManager = mock(LoggerManager.class);
when(mockPlugin.getLoggerManager()).thenReturn(mockLoggerManager);
when(mockPlugin.getPluginFallbackName()).thenReturn("parties");
when(mockPlugin.getFolder()).thenReturn(tempDir);
when(mockPlugin.getResource(anyString())).thenAnswer((mock) -> ClassLoader.getSystemResourceAsStream(mock.getArgument(0)));
when(mockLoggerManager.isDebugEnabled()).thenReturn(true);
// Mock managers for player/party initialization
ColorManager mockColorManager = mock(ColorManager.class);
when(mockPlugin.getColorManager()).thenReturn(mockColorManager);
when(mockColorManager.searchColorByName(anyString())).thenReturn(null);
PlayerManager mockPlayerManager = mock(PlayerManager.class);
when(mockPlugin.getPlayerManager()).thenReturn(mockPlayerManager);
when(mockPlayerManager.initializePlayer(any())).thenAnswer((mock) -> SQLDispatcherTest.initializePlayer(mockPlugin, mock.getArgument(0)));
PartyManager mockPartyManager = mock(PartyManager.class);
when(mockPlugin.getPartyManager()).thenReturn(mockPartyManager);
when(mockPartyManager.initializeParty(any())).thenAnswer((mock) -> SQLDispatcherTest.initializeParty(mockPlugin, mock.getArgument(0)));
// Mock names
OfflineUser mockOfflineUser = mock(OfflineUser.class);
when(mockPlugin.getOfflinePlayer(any())).thenReturn(mockOfflineUser);
when(mockOfflineUser.getName()).thenReturn("Dummy");
ConfigMain.STORAGE_SETTINGS_GENERAL_SQL_PREFIX = "test_";
staticPlugin = Mockito.mockStatic(ADPPlugin.class);
when(ADPPlugin.getInstance()).thenReturn(mockPlugin);
}
use of com.alessiodp.parties.common.parties.ColorManager in project Parties by AlessioDP.
the class PartiesPlugin method postHandle.
@Override
protected void postHandle() {
api = new ApiHandler(this, initApiOptions());
colorManager = new ColorManager();
cooldownManager = new CooldownManager(this);
expManager = new ExpManager(this);
playerUtils = new PartiesPlayerUtils(this);
rankManager = new RankManager(this);
getPartyManager().reload();
getPlayerManager().reload();
getCommandManager().setup();
getMessenger().reload();
getExpManager().reload();
registerListeners();
reloadAdpUpdater();
getAddonManager().loadAddons();
Parties.setApi(api);
}
use of com.alessiodp.parties.common.parties.ColorManager in project Parties by AlessioDP.
the class FileDispatcherTest method setUp.
@BeforeAll
public static void setUp(@TempDir Path tempDir) {
ADPBootstrap mockBootstrap = mock(ADPBootstrap.class);
LoggerManager mockLoggerManager = mock(LoggerManager.class);
when(mockPlugin.getPluginFallbackName()).thenReturn("parties");
when(mockPlugin.getFolder()).thenReturn(tempDir);
when(mockPlugin.getBootstrap()).thenReturn(mockBootstrap);
when(mockPlugin.getLoggerManager()).thenReturn(mockLoggerManager);
when(mockPlugin.getVersion()).thenReturn("1.0.0");
ColorManager mockColorManager = mock(ColorManager.class);
when(mockPlugin.getColorManager()).thenReturn(mockColorManager);
when(mockColorManager.searchColorByName(anyString())).thenReturn(null);
// Mock debug methods
when(mockPlugin.getResource(anyString())).thenAnswer((mock) -> ClassLoader.getSystemResourceAsStream(mock.getArgument(0)));
when(mockLoggerManager.isDebugEnabled()).thenReturn(true);
doAnswer((args) -> {
System.out.println((String) args.getArgument(0));
return null;
}).when(mockLoggerManager).logDebug(anyString(), anyBoolean());
doAnswer((args) -> {
System.out.println((String) args.getArgument(0));
return null;
}).when(mockLoggerManager).logError(anyString());
doAnswer((args) -> {
((Exception) args.getArgument(1)).printStackTrace();
return null;
}).when(mockLoggerManager).logError(any(), any());
// Mock names
OfflineUser mockOfflineUser = mock(OfflineUser.class);
when(mockPlugin.getOfflinePlayer(any())).thenReturn(mockOfflineUser);
when(mockOfflineUser.getName()).thenReturn("Dummy");
staticPlugin = Mockito.mockStatic(ADPPlugin.class);
when(ADPPlugin.getInstance()).thenReturn(mockPlugin);
}
use of com.alessiodp.parties.common.parties.ColorManager in project Parties by AlessioDP.
the class SQLDispatcherTest method setUp.
@BeforeAll
public static void setUp() {
ADPBootstrap mockBootstrap = mock(ADPBootstrap.class);
LoggerManager mockLoggerManager = mock(LoggerManager.class);
when(mockPlugin.getPluginFallbackName()).thenReturn("parties");
when(mockPlugin.getFolder()).thenReturn(Paths.get("../testing/"));
when(mockPlugin.getBootstrap()).thenReturn(mockBootstrap);
when(mockPlugin.getLoggerManager()).thenReturn(mockLoggerManager);
when(mockPlugin.getVersion()).thenReturn("1.0.0");
ColorManager mockColorManager = mock(ColorManager.class);
when(mockPlugin.getColorManager()).thenReturn(mockColorManager);
when(mockColorManager.searchColorByName(anyString())).thenReturn(null);
// Mock debug methods
when(mockPlugin.getResource(anyString())).thenAnswer((mock) -> ClassLoader.getSystemResourceAsStream(mock.getArgument(0)));
when(mockLoggerManager.isDebugEnabled()).thenReturn(true);
doAnswer((args) -> {
System.out.println((String) args.getArgument(0));
return null;
}).when(mockLoggerManager).logDebug(anyString(), anyBoolean());
doAnswer((args) -> {
((Exception) args.getArgument(1)).printStackTrace();
return null;
}).when(mockLoggerManager).logError(any(), any());
// Mock names
OfflineUser mockOfflineUser = mock(OfflineUser.class);
when(mockPlugin.getOfflinePlayer(any())).thenReturn(mockOfflineUser);
when(mockOfflineUser.getName()).thenReturn("Dummy");
ConfigMain.STORAGE_SETTINGS_GENERAL_SQL_PREFIX = "test_";
staticPlugin = mockStatic(ADPPlugin.class);
when(ADPPlugin.getInstance()).thenReturn(mockPlugin);
}
Aggregations