New Set of Testcases (subclassing for regression and backlog) to force card with no Image and being sure same results apply.

This commit is contained in:
leriomaggio
2021-07-26 11:31:54 +01:00
parent 04ae8fc28a
commit 29b9cb3ab0

View File

@@ -0,0 +1,44 @@
package forge.card;
import forge.ImageKeys;
import forge.item.PaperCard;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
/**
* Test Case for CardDb forcing No Image for all the cards.
* Check that everything still applies the same.
*
* Note: Run test for the class, being subclass will also run all
* other tests as regression.
*/
public class CardDbTestWithNoImage extends CardDbTestCase {
@Override
@BeforeMethod
public void setup(){
super.setup();
}
@Override
@BeforeMethod
protected void initMocks() throws Exception {
PowerMockito.mockStatic(ImageKeys.class);
PowerMockito.when(ImageKeys.hasImage(Mockito.any(PaperCard.class))).thenReturn(false);
super.initMocks();
}
@Test
public void testCardIsReturnedEvenIfThereIsNoImage(){
PaperCard shivanDragon = this.cardDb.getCard(cardNameShivanDragon);
assertNotNull(shivanDragon);
assertFalse(ImageKeys.hasImage(shivanDragon));
assertFalse(shivanDragon.hasImage());
}
}