MemoryCard extends Parent { public Rectangle getImageRectangle() { return this.card; } MemoryCard(final double positionX, final double positionY, final double width, final double height, final Image image, final int idc,
                      final IGameContext gameContext, final Stats stats, final Memory gameInstance, final int fixationlength, final boolean isOpen); boolean isTurned(); Rectangle getImageRectangle();  }
@Test void shouldCreateCardFromResourceInOpenMode() { String resource = "images/blue/blue.jpg"; Image img = new Image(resource); MemoryCard memoryCard = new MemoryCard(2, 2, 2, 2, img, 2, mockGameContext, mockStats, mockMemory, mockConfig.getFixationLength(), true); Image image = ((ImagePattern) memoryCard.getImageRectangle().getFill()).getImage(); assert image.getUrl().contains(resource); }
@Test void shouldCreateCardFromFileInOpenMode() { String resource = "file:" + System.getProperty("user.dir") + "src/test/resources/images/blue/blue.jpg"; Image img = new Image(resource); MemoryCard memoryCard = new MemoryCard(2, 2, 2, 2, img, 2, mockGameContext, mockStats, mockMemory, mockConfig.getFixationLength(), true); Image image = ((ImagePattern) memoryCard.getImageRectangle().getFill()).getImage(); assert image.getUrl().contains("blue.jpg"); }
@Test void shouldCreateCardFromFileInNotOpenModeAndFillWithBackCardImage() { String resource = "file:" + System.getProperty("user.dir") + "src/test/resources/images/blue/blue.jpg"; Image img = new Image(resource); MemoryCard memoryCard = new MemoryCard(2, 2, 2, 2, img, 2, mockGameContext, mockStats, mockMemory, mockConfig.getFixationLength(), false); Image image = ((ImagePattern) memoryCard.getImageRectangle().getFill()).getImage(); assert image.getUrl().contains("data/magiccards/images/red-card-game.png"); }
@Test void shouldCreateCardFromResourceInNotOpenModeAndFillWithBackCardImage() { String resource = "images/blue/blue.jpg"; Image img = new Image(resource); MemoryCard memoryCard = new MemoryCard(2, 2, 2, 2, img, 2, mockGameContext, mockStats, mockMemory, mockConfig.getFixationLength(), false); Image image = ((ImagePattern) memoryCard.getImageRectangle().getFill()).getImage(); assert image.getUrl().contains("data/magiccards/images/red-card-game.png"); }