use of de.gurkenlabs.litiengine.configuration.GraphicConfiguration in project litiengine by gurkenlabs.
the class LightSourceTests method render_withDynamicShadows.
@Test
void render_withDynamicShadows() {
// arrange
GameConfiguration actualGameConfigSpy = spy(Game.config());
GraphicConfiguration actualGraphicsConfigSpy = spy(actualGameConfigSpy.graphics());
MockedStatic<Game> gameMockedStatic = mockStatic(Game.class);
gameMockedStatic.when(Game::config).thenReturn(// otherwise it is null because of the mock
actualGameConfigSpy);
when(actualGameConfigSpy.graphics()).thenReturn(actualGraphicsConfigSpy);
when(actualGraphicsConfigSpy.renderDynamicShadows()).thenReturn(true);
Environment mockedEnv = mock(Environment.class);
GameWorld mockedWorld = mock(GameWorld.class);
when(mockedWorld.environment()).thenReturn(mockedEnv);
gameMockedStatic.when(Game::world).thenReturn(mockedWorld);
Graphics2D graphicMock = mock(Graphics2D.class);
assertTrue(Game.config().graphics().renderDynamicShadows());
// act
lightSourceInactiveSpy.render(graphicMock);
// assert
verify(mockedWorld, times(1)).environment();
// cleanup
gameMockedStatic.close();
}
Aggregations