Search in sources :

Example 1 with RenderEngine

use of de.gurkenlabs.litiengine.graphics.RenderEngine in project litiengine by gurkenlabs.

the class AbilityTests method testRender.

@Test
void testRender() {
    // arrange
    TestAbility ability = new TestAbility(new Creature());
    Graphics2D graphics = mock(Graphics2D.class);
    RenderEngine renderEngine = mock(RenderEngine.class);
    try (MockedStatic<Game> gameMockedStatic = mockStatic(Game.class)) {
        gameMockedStatic.when(Game::graphics).thenReturn(renderEngine);
        // act
        ability.render(graphics);
        // assert
        verify(renderEngine, times(1)).renderShape(any(Graphics2D.class), any(Shape.class));
        verify(renderEngine, times(1)).renderOutline(any(Graphics2D.class), any(Shape.class));
    }
}
Also used : Creature(de.gurkenlabs.litiengine.entities.Creature) Game(de.gurkenlabs.litiengine.Game) Shape(java.awt.Shape) RenderEngine(de.gurkenlabs.litiengine.graphics.RenderEngine) Graphics2D(java.awt.Graphics2D) Test(org.junit.jupiter.api.Test)

Aggregations

Game (de.gurkenlabs.litiengine.Game)1 Creature (de.gurkenlabs.litiengine.entities.Creature)1 RenderEngine (de.gurkenlabs.litiengine.graphics.RenderEngine)1 Graphics2D (java.awt.Graphics2D)1 Shape (java.awt.Shape)1 Test (org.junit.jupiter.api.Test)1