use of au.gov.asd.tac.constellation.utilities.font.FontUtilities in project constellation by constellation-app.
the class StartupNGTest method runSetsTitleEnvironmentIsNull.
@Test
public void runSetsTitleEnvironmentIsNull() {
try (final MockedStatic<WindowManager> windowManagerMockedStatic = Mockito.mockStatic(WindowManager.class);
final MockedStatic<FontUtilities> fontUtilitiesMockedStatic = Mockito.mockStatic(FontUtilities.class);
final MockedStatic<ProxyUtilities> proxyUtilitiesMockedStatic = Mockito.mockStatic(ProxyUtilities.class)) {
final WindowManager windowManager = mock(WindowManager.class);
windowManagerMockedStatic.when(WindowManager::getDefault).thenReturn(windowManager);
doAnswer(mockInvocation -> {
final Runnable runnable = (Runnable) mockInvocation.getArgument(0);
final JFrame frame = mock(JFrame.class);
when(windowManager.getMainWindow()).thenReturn(frame);
runnable.run();
verify(frame).setTitle("Constellation - (under development)");
return null;
}).when(windowManager).invokeWhenUIReady(any(Runnable.class));
new Startup().run();
fontUtilitiesMockedStatic.verify(FontUtilities::initialiseOutputFontPreferenceOnFirstUse);
fontUtilitiesMockedStatic.verify(FontUtilities::initialiseApplicationFontPreferenceOnFirstUse);
proxyUtilitiesMockedStatic.verify(() -> ProxyUtilities.setProxySelector(isNull()));
}
}
use of au.gov.asd.tac.constellation.utilities.font.FontUtilities in project constellation by constellation-app.
the class StartupNGTest method runSetsTitleEnvironmentNotNull.
@Test
public void runSetsTitleEnvironmentNotNull() {
try (final MockedStatic<WindowManager> windowManagerMockedStatic = Mockito.mockStatic(WindowManager.class);
final MockedStatic<FontUtilities> fontUtilitiesMockedStatic = Mockito.mockStatic(FontUtilities.class);
final MockedStatic<ProxyUtilities> proxyUtilitiesMockedStatic = Mockito.mockStatic(ProxyUtilities.class)) {
System.setProperty("constellation.environment", "development");
final WindowManager windowManager = mock(WindowManager.class);
windowManagerMockedStatic.when(WindowManager::getDefault).thenReturn(windowManager);
doAnswer(mockInvocation -> {
final Runnable runnable = (Runnable) mockInvocation.getArgument(0);
final JFrame frame = mock(JFrame.class);
when(windowManager.getMainWindow()).thenReturn(frame);
runnable.run();
verify(frame).setTitle("Constellation development - (under development)");
return null;
}).when(windowManager).invokeWhenUIReady(any(Runnable.class));
new Startup().run();
fontUtilitiesMockedStatic.verify(FontUtilities::initialiseOutputFontPreferenceOnFirstUse);
fontUtilitiesMockedStatic.verify(FontUtilities::initialiseApplicationFontPreferenceOnFirstUse);
proxyUtilitiesMockedStatic.verify(() -> ProxyUtilities.setProxySelector(isNull()));
} finally {
System.clearProperty("constellation.environment");
}
}
Aggregations