@ -0,0 +1,15 @@
package de.fd.fh;
public class FigureBishop extends Figure
{
@Override
public boolean moveAllowed(int src, int dst, Figure[] field)
if ((dst-src) % 8 == 0) // nach oben/unten nicht erlaubt
return false;
}
return super.moveAllowed(src, dst, field);
@ -0,0 +1,16 @@
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class FigureBishopTest
@Test
void checkInvalidMovesBishop()
Figure f = new FigureBishop();
assertFalse(f.moveAllowed(45, 37, new Figure[64]));